#include <iostream>
#include <cstdio>
#define For(i, n) for(int i = 0; i < (n); i++)
using namespace std;
const int N = 100 * 1000 + 10;
int vis_x[N];
int vis_y[N];
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int n, m;
scanf("%d %d", &n, &m);
int x_cnt = 0;
int y_cnt = 0;
For (i, m)
{
int x, y;
char c;
scanf("%d %c %d", &x, &c, &y);
if (c == '>' and !vis_x[x])
{
vis_x[x] = true;
x_cnt++;
}
else if (c == '<' and !vis_y[y])
{
vis_y[y] = true;
y_cnt++;
}
}
if (y_cnt == n)
puts("PRZEGRANA");
else if (x_cnt == n)
puts("WYGRANA");
else
puts("REMIS");
}
}
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 | #include <iostream> #include <cstdio> #define For(i, n) for(int i = 0; i < (n); i++) using namespace std; const int N = 100 * 1000 + 10; int vis_x[N]; int vis_y[N]; int main() { int t; scanf("%d", &t); while (t--) { int n, m; scanf("%d %d", &n, &m); int x_cnt = 0; int y_cnt = 0; For (i, m) { int x, y; char c; scanf("%d %c %d", &x, &c, &y); if (c == '>' and !vis_x[x]) { vis_x[x] = true; x_cnt++; } else if (c == '<' and !vis_y[y]) { vis_y[y] = true; y_cnt++; } } if (y_cnt == n) puts("PRZEGRANA"); else if (x_cnt == n) puts("WYGRANA"); else puts("REMIS"); } } |
English