#include <iostream>
using namespace std;
bool czyWygrywa[100002];
int ilePrzegrywa[100002];
int main() {
ios_base::sync_with_stdio(false);
int n, m, t;
cin>>t;
for(int i = 0; i < t; i++) {
cin>>n>>m;
int licznik = 0;
for(int j = 1; j <= n; j++) {
czyWygrywa[j] = false;
ilePrzegrywa[j] = 0;
}
for(int j = 0; j < m; j++) {
int bajtek, bitek;
char znak;
cin>>bajtek>>znak>>bitek;
if(znak == '>') {
ilePrzegrywa[bitek]++;
}
else {
if(!czyWygrywa[bitek]) {
licznik++;
czyWygrywa[bitek] = true;
}
}
}
if(licznik == n) {
cout<<"PRZEGRANA\n";
}
else {
for(int j = 1; j <= n; j++) {
if(ilePrzegrywa[j] == n) {
cout<<"WYGRANA\n";
break;
}
if(j == n) {
cout<<"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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #include <iostream> using namespace std; bool czyWygrywa[100002]; int ilePrzegrywa[100002]; int main() { ios_base::sync_with_stdio(false); int n, m, t; cin>>t; for(int i = 0; i < t; i++) { cin>>n>>m; int licznik = 0; for(int j = 1; j <= n; j++) { czyWygrywa[j] = false; ilePrzegrywa[j] = 0; } for(int j = 0; j < m; j++) { int bajtek, bitek; char znak; cin>>bajtek>>znak>>bitek; if(znak == '>') { ilePrzegrywa[bitek]++; } else { if(!czyWygrywa[bitek]) { licznik++; czyWygrywa[bitek] = true; } } } if(licznik == n) { cout<<"PRZEGRANA\n"; } else { for(int j = 1; j <= n; j++) { if(ilePrzegrywa[j] == n) { cout<<"WYGRANA\n"; break; } if(j == n) { cout<<"REMIS\n"; } } } } return 0; } |
English