#include <iostream> #include <algorithm> #include <vector> #include <unordered_map> #include <unordered_set> #include <memory> struct player { int size; player(int n): size(n) {}; std::unordered_set<int> sources; }; int main() { int t; std::cin >> t; while(t--) { int n, m; std::cin >> n >> m; player pa(n), pb(n); while(m--) { int a,b; char w; std::cin >> a >> w >> b; if (w == '>') { pa.sources.insert(a); } else { pb.sources.insert(b); } } if (pb.sources.size() == n) { std::cout << "PRZEGRANA\n"; } else if (pa.sources.size() == n) { std::cout << "WYGRANA\n"; } else { std::cout << "REMIS\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 48 | #include <iostream> #include <algorithm> #include <vector> #include <unordered_map> #include <unordered_set> #include <memory> struct player { int size; player(int n): size(n) {}; std::unordered_set<int> sources; }; int main() { int t; std::cin >> t; while(t--) { int n, m; std::cin >> n >> m; player pa(n), pb(n); while(m--) { int a,b; char w; std::cin >> a >> w >> b; if (w == '>') { pa.sources.insert(a); } else { pb.sources.insert(b); } } if (pb.sources.size() == n) { std::cout << "PRZEGRANA\n"; } else if (pa.sources.size() == n) { std::cout << "WYGRANA\n"; } else { std::cout << "REMIS\n"; } } return 0; } |