#include <cstdio> #include <vector> #include <algorithm> void solve() { char w[2]; int n, m; scanf("%d%d", &n, &m); std::vector<bool> b_wins(n, 0); std::vector<int> b_loses_counts(n, 0); for (int i = 0; i < m; ++i) { int a,b; scanf("%d%s%d", &a, w, &b); --a, --b; if (w[0] == '>') { ++b_loses_counts[b]; } else if (w[0] == '<') { b_wins[b] = true; } } if (std::find(b_wins.begin(), b_wins.end(), false) == b_wins.end()) { printf("PRZEGRANA\n"); } else if (std::find(b_loses_counts.begin(), b_loses_counts.end(), n) != b_loses_counts.end()) { printf("WYGRANA\n"); } else { printf("REMIS\n"); } } int main() { int t; scanf("%d", &t); for (int i = 0; i < t; ++i) { solve(); } }
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 | #include <cstdio> #include <vector> #include <algorithm> void solve() { char w[2]; int n, m; scanf("%d%d", &n, &m); std::vector<bool> b_wins(n, 0); std::vector<int> b_loses_counts(n, 0); for (int i = 0; i < m; ++i) { int a,b; scanf("%d%s%d", &a, w, &b); --a, --b; if (w[0] == '>') { ++b_loses_counts[b]; } else if (w[0] == '<') { b_wins[b] = true; } } if (std::find(b_wins.begin(), b_wins.end(), false) == b_wins.end()) { printf("PRZEGRANA\n"); } else if (std::find(b_loses_counts.begin(), b_loses_counts.end(), n) != b_loses_counts.end()) { printf("WYGRANA\n"); } else { printf("REMIS\n"); } } int main() { int t; scanf("%d", &t); for (int i = 0; i < t; ++i) { solve(); } } |