#include<iostream> #include<vector> using namespace std; int main() { ios_base::sync_with_stdio(false); int t, n, m; cin >> t; for (int i = 0; i < t; i++) { cin >> n >> m; vector<int> b_loses(n); vector<bool> b_wins(n); int a, b; char w; for (int j = 0; j < m; j++) { cin >> a >> w >> b; b--; if (w == '<') { b_wins[b] = true; } else { b_loses[b]++; } } bool a_win = false, draw = false; for (int j = 0; j < n; j++) { a_win |= (b_loses[j] == n); draw |= !b_wins[j]; } if (a_win) cout << "WYGRANA\n"; else if (draw) cout << "REMIS\n"; else cout << "PRZEGRANA\n"; } }
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 | #include<iostream> #include<vector> using namespace std; int main() { ios_base::sync_with_stdio(false); int t, n, m; cin >> t; for (int i = 0; i < t; i++) { cin >> n >> m; vector<int> b_loses(n); vector<bool> b_wins(n); int a, b; char w; for (int j = 0; j < m; j++) { cin >> a >> w >> b; b--; if (w == '<') { b_wins[b] = true; } else { b_loses[b]++; } } bool a_win = false, draw = false; for (int j = 0; j < n; j++) { a_win |= (b_loses[j] == n); draw |= !b_wins[j]; } if (a_win) cout << "WYGRANA\n"; else if (draw) cout << "REMIS\n"; else cout << "PRZEGRANA\n"; } } |