#include <cstdio> using namespace std; int A[1000006],B[1000006]; int main() { int t; scanf("%d",&t); while (t--) { int n,m; scanf("%d%d",&n,&m); for ( int i=0; i<n; i++ ) A[i]=B[i]=0; while (m--) { int a,b; char c; scanf("%d %c %d",&a,&c,&b); a--;b--; if ( c=='>' ) A[b]++; else B[b]++; } int pp = 1; for ( int i=0; i<n; i++ ) if ( !B[i] ) { pp=0; break; } if ( pp ) { printf("PRZEGRANA\n"); goto __case_end; } for ( int i=0; i<n; i++ ) if (A[i]>=n) { printf("WYGRANA\n"); goto __case_end; } printf("REMIS\n"); __case_end:; } 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 | #include <cstdio> using namespace std; int A[1000006],B[1000006]; int main() { int t; scanf("%d",&t); while (t--) { int n,m; scanf("%d%d",&n,&m); for ( int i=0; i<n; i++ ) A[i]=B[i]=0; while (m--) { int a,b; char c; scanf("%d %c %d",&a,&c,&b); a--;b--; if ( c=='>' ) A[b]++; else B[b]++; } int pp = 1; for ( int i=0; i<n; i++ ) if ( !B[i] ) { pp=0; break; } if ( pp ) { printf("PRZEGRANA\n"); goto __case_end; } for ( int i=0; i<n; i++ ) if (A[i]>=n) { printf("WYGRANA\n"); goto __case_end; } printf("REMIS\n"); __case_end:; } return 0; } |