#include <iostream> #include <stdio.h> using namespace std; int main() { int t, b, c, n, m, done; char signc[1]; scanf("%d",&t); for (int i=0; i<t;i++){ scanf("%d %d", &n, &m); int win[100001]={}; int lose[100001]={}; done=0; for (int a=0; a<m; a++){ scanf("%d %1s %d", &b, signc, &c); string sign= signc; if (sign == ">"){win[c]++;} if (sign == "<"){lose[c]++;} } for (int a=0;a<n;a++){ if (win[a+1]==n){printf("WYGRANA\n"); done=1;break;}} if(done==0){ for (int a=0;a<n;a++){ if (lose[a+1]==0){printf("REMIS\n"); done=1; break;}} } if (done== 0) {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 | #include <iostream> #include <stdio.h> using namespace std; int main() { int t, b, c, n, m, done; char signc[1]; scanf("%d",&t); for (int i=0; i<t;i++){ scanf("%d %d", &n, &m); int win[100001]={}; int lose[100001]={}; done=0; for (int a=0; a<m; a++){ scanf("%d %1s %d", &b, signc, &c); string sign= signc; if (sign == ">"){win[c]++;} if (sign == "<"){lose[c]++;} } for (int a=0;a<n;a++){ if (win[a+1]==n){printf("WYGRANA\n"); done=1;break;}} if(done==0){ for (int a=0;a<n;a++){ if (lose[a+1]==0){printf("REMIS\n"); done=1; break;}} } if (done== 0) {printf("PRZEGRANA\n");} } return 0; } |