#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);
#define M 100010
using namespace std;
bool Wa[M],Wb[M];
int z,n,m,a,b,ilosca,iloscb;
char w;
int main()
{
IOS;
cin>>z;
while(z--)
{
cin>>n>>m;
for(int i=1;i<=m;i++)
{
cin>>a>>w>>b;
if(w=='>')
{
if(!Wa[a])
{
ilosca++;
Wa[a]=true;
}
}
else
{
if(!Wb[b])
{
iloscb++;
Wb[b]=true;
}
}
}
if(ilosca==n)puts("WYGRANA");
else if(iloscb==n)puts("PRZEGRANA");
else puts("REMIS");
memset(Wa+1,false,n+1),memset(Wb+1,false,n+1);
ilosca=iloscb=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 | #include <bits/stdc++.h> #define IOS ios_base::sync_with_stdio(0); #define M 100010 using namespace std; bool Wa[M],Wb[M]; int z,n,m,a,b,ilosca,iloscb; char w; int main() { IOS; cin>>z; while(z--) { cin>>n>>m; for(int i=1;i<=m;i++) { cin>>a>>w>>b; if(w=='>') { if(!Wa[a]) { ilosca++; Wa[a]=true; } } else { if(!Wb[b]) { iloscb++; Wb[b]=true; } } } if(ilosca==n)puts("WYGRANA"); else if(iloscb==n)puts("PRZEGRANA"); else puts("REMIS"); memset(Wa+1,false,n+1),memset(Wb+1,false,n+1); ilosca=iloscb=0; } return 0; } |
English