#include <cstdio> #include <cstring> int cnt[110000]; bool isset[110000]; int main() { int T; scanf("%d",&T); while (T-- > 0) { int N,M; scanf("%d %d",&N,&M); memset(cnt,0,(N+1)*sizeof(int)); memset(isset,0,(N+1)*sizeof(bool)); for (int i=0; i<M; ++i) { int A,B; char C; scanf("%d %c %d",&A,&C,&B); if (C=='>') cnt[B]++; else isset[B]++; } bool win = false; int sum = 0; for (int i=1; i<=N; ++i) { if (cnt[i] == N) win = true; if (isset[i]) sum++; } if (win) printf("WYGRANA\n"); else if (sum==N) printf("PRZEGRANA\n"); else printf("REMIS\n"); } return 0; }
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 33 34 35 36 37 38 39 40 | #include <cstdio> #include <cstring> int cnt[110000]; bool isset[110000]; int main() { int T; scanf("%d",&T); while (T-- > 0) { int N,M; scanf("%d %d",&N,&M); memset(cnt,0,(N+1)*sizeof(int)); memset(isset,0,(N+1)*sizeof(bool)); for (int i=0; i<M; ++i) { int A,B; char C; scanf("%d %c %d",&A,&C,&B); if (C=='>') cnt[B]++; else isset[B]++; } bool win = false; int sum = 0; for (int i=1; i<=N; ++i) { if (cnt[i] == N) win = true; if (isset[i]) sum++; } if (win) printf("WYGRANA\n"); else if (sum==N) printf("PRZEGRANA\n"); else printf("REMIS\n"); } return 0; } |