#include<cstdio>
#include<vector>
#include<set>
void play(){
int m,n,a,b;
char result;
std::set<int> remis;
std::scanf("%d%d", &n,&m);
int wygrana[n];
for (int i = 0; i < n; i++)
wygrana[i] = 0;
for (int i = 0; i < n; i++){
scanf("%d %c %d", &a, &result, &b);
if ( result == '<' )
remis.insert(b);
else
wygrana[b - 1]++;
}
for (int i = 0; i < n; i++){
if(wygrana[i] == n){
std::printf("WYGRANA\n");
return;
}
}
if(remis.size() < n){
std::printf("REMIS\n");
return;
}
std::printf("PRZEGRANA\n");
}
int main(){
int t;
std::scanf("%d", &t);
for(int i = 0; i < t; i++)
play();
}
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 | #include<cstdio> #include<vector> #include<set> void play(){ int m,n,a,b; char result; std::set<int> remis; std::scanf("%d%d", &n,&m); int wygrana[n]; for (int i = 0; i < n; i++) wygrana[i] = 0; for (int i = 0; i < n; i++){ scanf("%d %c %d", &a, &result, &b); if ( result == '<' ) remis.insert(b); else wygrana[b - 1]++; } for (int i = 0; i < n; i++){ if(wygrana[i] == n){ std::printf("WYGRANA\n"); return; } } if(remis.size() < n){ std::printf("REMIS\n"); return; } std::printf("PRZEGRANA\n"); } int main(){ int t; std::scanf("%d", &t); for(int i = 0; i < t; i++) play(); } |
English