#include <iostream> #include <cstdio> using namespace std; int t, n, m, sum1, sum2, a, b, g[21][100005], g2[21][100005], maks1, maks2, il2; char s; bool b2[21][100005]; int main() { scanf("%d", &t); for(int i=1;i<=t;i++) { scanf("%d", &n); scanf("%d", &m); sum1=0; sum2=0; maks1=0; maks2=0; il2=0; for(int j=1;j<=m;j++) { scanf("%d", &a); scanf("%s", &s); scanf("%d", &b); if(s=='>') { g[i][b]+=1; maks1=max(maks1,g[i][b]); } else { g2[i][a]+=1; maks2=max(maks2,g2[i][a]); if(!b2[i][b]) { il2+=1; b2[i][b]=1; } } } if(maks1==n) printf("WYGRANA\n"); else if(maks2==n || il2==n) printf("PRZEGRANA\n"); else printf("REMIS\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 | #include <iostream> #include <cstdio> using namespace std; int t, n, m, sum1, sum2, a, b, g[21][100005], g2[21][100005], maks1, maks2, il2; char s; bool b2[21][100005]; int main() { scanf("%d", &t); for(int i=1;i<=t;i++) { scanf("%d", &n); scanf("%d", &m); sum1=0; sum2=0; maks1=0; maks2=0; il2=0; for(int j=1;j<=m;j++) { scanf("%d", &a); scanf("%s", &s); scanf("%d", &b); if(s=='>') { g[i][b]+=1; maks1=max(maks1,g[i][b]); } else { g2[i][a]+=1; maks2=max(maks2,g2[i][a]); if(!b2[i][b]) { il2+=1; b2[i][b]=1; } } } if(maks1==n) printf("WYGRANA\n"); else if(maks2==n || il2==n) printf("PRZEGRANA\n"); else printf("REMIS\n"); } return 0; } |