#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int res[N];
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
int n, m;
scanf("%d%d", &n, &m);
while(m--)
{
int a, b;
char c;
scanf("%d %c%d", &a, &c, &b);
if(c=='>'&&res[b]<=0) --res[b];
if(c=='<') res[b]=1;
}
int mn=1;
for(int i=1; i<=n; ++i) mn=min(mn, res[i]);
if(mn==-n) printf("WYGRANA\n");
else if(mn<=0) printf("REMIS\n");
else if(mn==1) printf("PRZEGRANA\n");
fill(res, res+n+5, 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 | #include <bits/stdc++.h> using namespace std; const int N=1e5+5; int res[N]; int main() { int t; scanf("%d", &t); while(t--) { int n, m; scanf("%d%d", &n, &m); while(m--) { int a, b; char c; scanf("%d %c%d", &a, &c, &b); if(c=='>'&&res[b]<=0) --res[b]; if(c=='<') res[b]=1; } int mn=1; for(int i=1; i<=n; ++i) mn=min(mn, res[i]); if(mn==-n) printf("WYGRANA\n"); else if(mn<=0) printf("REMIS\n"); else if(mn==1) printf("PRZEGRANA\n"); fill(res, res+n+5, 0); } } |
English