#include <bits/stdc++.h> using namespace std; vector <int> karty; int main(){ int a, b, n, m, t, wgrA, wgrB, pgrA, pgrB; char z; string odp[] = {"WYGRANA", "REMIS", "PRZEGRANA"}; scanf("%d\n", &t); while(t--){ scanf("%d %d\n", &n, &m); wgrA = wgrB = pgrA = pgrB = 0; vector <int> A(n), B(n); for (int i = 0; i < m; ++i){ scanf("%d %c %d\n", &a, &z, &b); if (z == '>'){ if (A[a] <= 0){ wgrA++; A[a] = 1; } } else { if (B[b] <= 0){ wgrB++; B[b] = 1; } } } if (wgrA == n) puts(odp[0].c_str()); else if (wgrB == n) puts(odp[2].c_str()); else puts(odp[1].c_str()); } }
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 <bits/stdc++.h> using namespace std; vector <int> karty; int main(){ int a, b, n, m, t, wgrA, wgrB, pgrA, pgrB; char z; string odp[] = {"WYGRANA", "REMIS", "PRZEGRANA"}; scanf("%d\n", &t); while(t--){ scanf("%d %d\n", &n, &m); wgrA = wgrB = pgrA = pgrB = 0; vector <int> A(n), B(n); for (int i = 0; i < m; ++i){ scanf("%d %c %d\n", &a, &z, &b); if (z == '>'){ if (A[a] <= 0){ wgrA++; A[a] = 1; } } else { if (B[b] <= 0){ wgrB++; B[b] = 1; } } } if (wgrA == n) puts(odp[0].c_str()); else if (wgrB == n) puts(odp[2].c_str()); else puts(odp[1].c_str()); } } |