#include<cstdio> int t, n, m, a, b; char c; int tab_1[120000]; int tab_2[120000]; void clear_tabs(){ for (int i = 1; i <= n; ++i){ tab_1[i] = tab_2[i] = 0; } } void solve(){ for (int i = 1; i <= n; ++i){ if (tab_1[i] == n){ printf ("WYGRANA\n"); return; } } bool all = true; for (int i = 1; i <= n; ++i) if (tab_2[i] == 0) all = false; if (all){ printf ("PRZEGRANA\n"); return; } printf ("REMIS\n"); } int main(){ scanf ("%d", &t); while(t--){ scanf ("%d %d", &n, &m); for (int i = 0; i < m; ++i){ scanf ("%d %c %d", &a, &c, &b); if (c == '>') tab_1[b]++; else tab_2[b]++; } solve(); clear_tabs(); } }
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 41 42 43 44 | #include<cstdio> int t, n, m, a, b; char c; int tab_1[120000]; int tab_2[120000]; void clear_tabs(){ for (int i = 1; i <= n; ++i){ tab_1[i] = tab_2[i] = 0; } } void solve(){ for (int i = 1; i <= n; ++i){ if (tab_1[i] == n){ printf ("WYGRANA\n"); return; } } bool all = true; for (int i = 1; i <= n; ++i) if (tab_2[i] == 0) all = false; if (all){ printf ("PRZEGRANA\n"); return; } printf ("REMIS\n"); } int main(){ scanf ("%d", &t); while(t--){ scanf ("%d %d", &n, &m); for (int i = 0; i < m; ++i){ scanf ("%d %c %d", &a, &c, &b); if (c == '>') tab_1[b]++; else tab_2[b]++; } solve(); clear_tabs(); } } |