#include <algorithm> #include <cstdint> #include <iostream> #include <vector> int main(void) { int32_t t; scanf("%d", &t); for (size_t i = 0; i < t; i++) { int32_t n, m; scanf("%d %d", &n, &m); std::vector<int32_t> x, y; for (size_t j = 0; j < m; j++) { char w; int32_t a, b; scanf("%d %c %d", &a, &w, &b); if (w == '>') x.push_back(a); else y.push_back(b); } std::sort(x.begin(), x.end()); std::sort(y.begin(), y.end()); std::vector<int>::iterator it_x = std::unique(x.begin(), x.end()); x.resize(distance(x.begin(), it_x)); std::vector<int>::iterator it_y = std::unique(y.begin(), y.end()); y.resize(distance(y.begin(), it_y)); int32_t X = x.size() - (n - 1); int32_t Y = y.size() - (n - 1); if ((X <= 0 && Y <= 0) || X == Y) { printf("REMIS\n"); continue; } if (X > Y) printf("WYGRANA\n"); else printf("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 48 49 50 | #include <algorithm> #include <cstdint> #include <iostream> #include <vector> int main(void) { int32_t t; scanf("%d", &t); for (size_t i = 0; i < t; i++) { int32_t n, m; scanf("%d %d", &n, &m); std::vector<int32_t> x, y; for (size_t j = 0; j < m; j++) { char w; int32_t a, b; scanf("%d %c %d", &a, &w, &b); if (w == '>') x.push_back(a); else y.push_back(b); } std::sort(x.begin(), x.end()); std::sort(y.begin(), y.end()); std::vector<int>::iterator it_x = std::unique(x.begin(), x.end()); x.resize(distance(x.begin(), it_x)); std::vector<int>::iterator it_y = std::unique(y.begin(), y.end()); y.resize(distance(y.begin(), it_y)); int32_t X = x.size() - (n - 1); int32_t Y = y.size() - (n - 1); if ((X <= 0 && Y <= 0) || X == Y) { printf("REMIS\n"); continue; } if (X > Y) printf("WYGRANA\n"); else printf("PRZEGRANA\n"); } return 0; } |