71. 一个游戏

194#0036

有重边是真的难受!

Money4

数组下标有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");
    }
}
你当前正在回复 博客/题目
存在问题!