#include <cstdio> #include <algorithm> using namespace std; #define span_n(x, n) x, x+n const int nLim = 100001; char A[nLim]; char B[nLim]; void SolveCase(); int main() { int t; scanf("%d", &t); for(int i = 0; i < t; ++i) SolveCase(); return 0; } void SolveCase() { int n, m; scanf("%d%d", &n, &m); fill_n(A+1, n, 0); fill_n(B+1, n, 0); for(int i = 0; i < m; ++i) { int a, b; char w; scanf("%d%*c%c%*c%d", &a, &w, &b); if(w == '>') A[a] = 1; else B[b] = 1; } auto isOne = [] (char c) { return c == 1; }; if(all_of(span_n(A+1, n), isOne)) puts("WYGRANA"); else if(all_of(span_n(B+1, n), isOne)) puts("PRZEGRANA"); else puts("REMIS"); }
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 | #include <cstdio> #include <algorithm> using namespace std; #define span_n(x, n) x, x+n const int nLim = 100001; char A[nLim]; char B[nLim]; void SolveCase(); int main() { int t; scanf("%d", &t); for(int i = 0; i < t; ++i) SolveCase(); return 0; } void SolveCase() { int n, m; scanf("%d%d", &n, &m); fill_n(A+1, n, 0); fill_n(B+1, n, 0); for(int i = 0; i < m; ++i) { int a, b; char w; scanf("%d%*c%c%*c%d", &a, &w, &b); if(w == '>') A[a] = 1; else B[b] = 1; } auto isOne = [] (char c) { return c == 1; }; if(all_of(span_n(A+1, n), isOne)) puts("WYGRANA"); else if(all_of(span_n(B+1, n), isOne)) puts("PRZEGRANA"); else puts("REMIS"); } |