有重边是真的难受!
数组下标有0 WA了4 5发 FO了
#include <bits/stdc++.h>
using namespace std;
int a[100001];
bool flag = false;
int main() {
int T;
cin >> T;
for (int t = 0; t < T; t++) {
flag = false;
int b[101];
int n;
cin >> n;
memset(a, false, sizeof(bool) * 100001);
for (int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
if (a[x] && y != b[a[x]-1]) {
flag = true;
}
a[x] = i+1;
b[i] = y;
}
if (n == 1) {
printf("Lucky dxw!\n");
continue;
}
if (flag) {
printf("Poor dxw!\n");
continue;
}
for (int i = 0; i < n; i++) {
if (a[b[i]] > 0) {
flag = true;
printf("Poor dxw!\n");
break;
}
}
if (flag) continue;
else printf("Lucky dxw!\n");
}
}
谢谢大佬指出问题所在