//PA2016, runda 1, Gra w karty
// Andrzej Pezarski
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int T;
scanf("%d", &T);
while(T--) {
int n, m;
scanf("%d%d", &n, &m);
vector<int> v(n), v2(n, n);
while(m--) {
int a, b;
char w[4];
scanf("%d%s%d", &a, w, &b);
a--, b--;
if (w[0]=='<') v[b]++;
else v2[b]--;
}
int x1=0, x2=0;
for (auto &x:v) if (x==0) x1++;
for (auto &x:v2) if (x==0) x2++;
if (x1==0) printf("PRZEGRANA\n");
else if(x2==0) printf("REMIS\n");
else printf("WYGRANA\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 | //PA2016, runda 1, Gra w karty // Andrzej Pezarski #include <cstdio> #include <cstdlib> #include <vector> #include <algorithm> using namespace std; int main() { int T; scanf("%d", &T); while(T--) { int n, m; scanf("%d%d", &n, &m); vector<int> v(n), v2(n, n); while(m--) { int a, b; char w[4]; scanf("%d%s%d", &a, w, &b); a--, b--; if (w[0]=='<') v[b]++; else v2[b]--; } int x1=0, x2=0; for (auto &x:v) if (x==0) x1++; for (auto &x:v2) if (x==0) x2++; if (x1==0) printf("PRZEGRANA\n"); else if(x2==0) printf("REMIS\n"); else printf("WYGRANA\n"); } return 0; } |
English