#include <iostream>
using namespace std;
int n,m,t,a,b,baj,bit;
char w;
bool spr[200005],spr2[200005];
int main()
{
cin>>t;
for (int j=0;j<t;j++)
{
cin>>n>>m;
for (int i=0;i<m;i++)
{
cin>>a>>w>>b;
if (w=='>'&&spr[a]==false)
{
baj++;
spr[a]=true;
}
if (w=='<'&&spr2[b]==false)
{
bit++;
spr2[b]=true;
}
}
if (baj>=n)
cout<<"WYGRANA\n";
else
{
if (bit>=n)
cout<<"PRZEGRANA\n";
else
{
cout<<"REMIS\n";
}
}
baj=0;
bit=0;
}
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 | #include <iostream> using namespace std; int n,m,t,a,b,baj,bit; char w; bool spr[200005],spr2[200005]; int main() { cin>>t; for (int j=0;j<t;j++) { cin>>n>>m; for (int i=0;i<m;i++) { cin>>a>>w>>b; if (w=='>'&&spr[a]==false) { baj++; spr[a]=true; } if (w=='<'&&spr2[b]==false) { bit++; spr2[b]=true; } } if (baj>=n) cout<<"WYGRANA\n"; else { if (bit>=n) cout<<"PRZEGRANA\n"; else { cout<<"REMIS\n"; } } baj=0; bit=0; } return 0; } |
English