#include <bits/stdc++.h> using namespace std; const int nax = 200123; int cnt[nax]; bool bad[nax]; void te() { int n, m; scanf("%d%d", &n, &m); int best = 0, cnt_bad = 0; while(m--) { int a, b; char type; scanf("%d %c %d", &a, &type, &b); if(type == '>') best = max(best, ++cnt[b]); else if(!bad[b]) { bad[b] = true; ++cnt_bad; } } if(best == n) puts("WYGRANA"); else if(cnt_bad != n) puts("REMIS"); else puts("PRZEGRANA"); for(int i = 0; i <= n + 1; ++i) { bad[i] = false; cnt[i] = 0; } } int main() { int T; scanf("%d", &T); while(T--) te(); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <bits/stdc++.h> using namespace std; const int nax = 200123; int cnt[nax]; bool bad[nax]; void te() { int n, m; scanf("%d%d", &n, &m); int best = 0, cnt_bad = 0; while(m--) { int a, b; char type; scanf("%d %c %d", &a, &type, &b); if(type == '>') best = max(best, ++cnt[b]); else if(!bad[b]) { bad[b] = true; ++cnt_bad; } } if(best == n) puts("WYGRANA"); else if(cnt_bad != n) puts("REMIS"); else puts("PRZEGRANA"); for(int i = 0; i <= n + 1; ++i) { bad[i] = false; cnt[i] = 0; } } int main() { int T; scanf("%d", &T); while(T--) te(); } |