#include <iostream> #include <vector> using namespace std; int main() { int t, n, m; cin >> t; for (int tt = 0; tt < t; tt++) { int n, m; cin >> n >> m; vector<int> dega(n), degb(n); for (int i = 0; i < m; i++) { int a, b; string s; cin >> a >> s >> b; if (s == ">") dega[b-1]++; else degb[b-1]++; } bool wygrana = false; bool remis = false; for (int i = 0; i < n; i++) { if (dega[i] == n) wygrana = true; if (degb[i] == 0) remis = true; } if (wygrana) cout << "WYGRANA\n"; else if (remis) cout << "REMIS\n"; else cout << "PRZEGRANA\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 41 42 43 44 45 46 47 | #include <iostream> #include <vector> using namespace std; int main() { int t, n, m; cin >> t; for (int tt = 0; tt < t; tt++) { int n, m; cin >> n >> m; vector<int> dega(n), degb(n); for (int i = 0; i < m; i++) { int a, b; string s; cin >> a >> s >> b; if (s == ">") dega[b-1]++; else degb[b-1]++; } bool wygrana = false; bool remis = false; for (int i = 0; i < n; i++) { if (dega[i] == n) wygrana = true; if (degb[i] == 0) remis = true; } if (wygrana) cout << "WYGRANA\n"; else if (remis) cout << "REMIS\n"; else cout << "PRZEGRANA\n"; } return 0; } |