#include <cstdio> int main() { int a, b, i, n, m, t, out, IN[100001], OUT[100001]; char w, tmp1, tmp2; scanf ("%d", &t); while (t--) { scanf ("%d%d", &n, &m); for (i = 0; i <= n; ++i) IN[i] = OUT[i] = 0; while (m--) { scanf ("%d%c%c%c%d", &a, &tmp1, &w, &tmp2, &b); if (w == '<') OUT[b]++; else if (w == '>') IN[b]++; } out = 0; a = 0; for (i = 1; i <= n; ++i) if (IN[i] == n){ a = 1; break; } else if (OUT[i] > 0){ out++;} if (a == 1) printf ("WYGRANA\n"); else if (out == 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 | #include <cstdio> int main() { int a, b, i, n, m, t, out, IN[100001], OUT[100001]; char w, tmp1, tmp2; scanf ("%d", &t); while (t--) { scanf ("%d%d", &n, &m); for (i = 0; i <= n; ++i) IN[i] = OUT[i] = 0; while (m--) { scanf ("%d%c%c%c%d", &a, &tmp1, &w, &tmp2, &b); if (w == '<') OUT[b]++; else if (w == '>') IN[b]++; } out = 0; a = 0; for (i = 1; i <= n; ++i) if (IN[i] == n){ a = 1; break; } else if (OUT[i] > 0){ out++;} if (a == 1) printf ("WYGRANA\n"); else if (out == n) printf ("PRZEGRANA\n"); else printf ("REMIS\n"); } return 0; } |