#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, m, ca[N], cb[N]; void solve() { for (int i = 0; i < n; ++i) { ca[i] = cb[i] = 0; } cin >> n >> m; for (int i = 0; i < m; ++i) { int x, y; char cmp; cin >> x >> cmp >> y; --x; --y; if (cmp == '>') { ++cb[y]; } else { ++ca[y]; } } bool all = true; for (int i = 0; i < n; ++i) { if (cb[i] == n) { cout << "WYGRANA\n"; return; } if (!ca[i]) all = false; } if (all) cout << "PRZEGRANA\n"; else cout << "REMIS\n"; } int main() { ios::sync_with_stdio(false); int z; cin >> z; while (z--) solve(); 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 | #include <bits/stdc++.h> using namespace std; const int N = 100005; int n, m, ca[N], cb[N]; void solve() { for (int i = 0; i < n; ++i) { ca[i] = cb[i] = 0; } cin >> n >> m; for (int i = 0; i < m; ++i) { int x, y; char cmp; cin >> x >> cmp >> y; --x; --y; if (cmp == '>') { ++cb[y]; } else { ++ca[y]; } } bool all = true; for (int i = 0; i < n; ++i) { if (cb[i] == n) { cout << "WYGRANA\n"; return; } if (!ca[i]) all = false; } if (all) cout << "PRZEGRANA\n"; else cout << "REMIS\n"; } int main() { ios::sync_with_stdio(false); int z; cin >> z; while (z--) solve(); return 0; } |