题解
2026-09-13 14:02:03
发布于:广东
#include <bits/stdc++.h>
using namespace std;
static char buf[1 << 20];
static int bufPos = 0, bufLen = 0;
static inline char gc() {
if (bufPos == bufLen) {
bufLen = fread(buf, 1, sizeof(buf), stdin);
bufPos = 0;
if (bufLen == 0) return 0;
}
return buf[bufPos++];
}
static inline int read() {
int x = 0;
char c = gc();
while (c < '0' || c > '9') c = gc();
while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = gc(); }
return x;
}
int main() {
int T = read();
while (T--) {
int N = read(), M = read();
int n = 0, m = 0;
unsigned long long h1 = 0, h2 = 0;
for (int i = 0; i < N; i++) {
int x = read();
if (x) { n++; h1 += (unsigned long long)x * 1315423911ULL + x * x; }
}
for (int i = 0; i < M; i++) {
int x = read();
if (x) { m++; h2 += (unsigned long long)x * 1315423911ULL + x * x; }
}
if (n != m) { puts("Macw"); continue; }
puts(h1 == h2 ? "Penelope" : "Macw");
}
return 0;
}
这里空空如也





有帮助,赞一个