#include <stdio.h> #include <string.h> #define SIZE 200000 int kartyA[SIZE]; int kartyB[SIZE]; void one_case(){ int n,m; char comp[12]; int a, b; int win = 0; int hitB = 0; scanf("%d %d",&n,&m); memset(kartyA,0,SIZE * sizeof(int)); memset(kartyB,0,SIZE * sizeof(int)); for(int i = 0; i < m; i++){ scanf("%d %s %d",&a,comp,&b); if (comp[0] == '>'){ kartyA[b]++; if (kartyA[b] == n) win = 1; } else { if (kartyB[b] == 0) hitB++; kartyB[b] = 1; } } if (win == 1){ printf("WYGRANA\n"); } else if (hitB == n){ printf("PRZEGRANA\n"); } else { printf("REMIS\n"); } } int main(){ int t; scanf("%d",&t); for(int i = 0; i < t; i++) one_case(); 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 | #include <stdio.h> #include <string.h> #define SIZE 200000 int kartyA[SIZE]; int kartyB[SIZE]; void one_case(){ int n,m; char comp[12]; int a, b; int win = 0; int hitB = 0; scanf("%d %d",&n,&m); memset(kartyA,0,SIZE * sizeof(int)); memset(kartyB,0,SIZE * sizeof(int)); for(int i = 0; i < m; i++){ scanf("%d %s %d",&a,comp,&b); if (comp[0] == '>'){ kartyA[b]++; if (kartyA[b] == n) win = 1; } else { if (kartyB[b] == 0) hitB++; kartyB[b] = 1; } } if (win == 1){ printf("WYGRANA\n"); } else if (hitB == n){ printf("PRZEGRANA\n"); } else { printf("REMIS\n"); } } int main(){ int t; scanf("%d",&t); for(int i = 0; i < t; i++) one_case(); return 0; } |