#include <iostream>
using namespace std;
int ujemnydeg[100001];
int main()
{ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
short t;
bool zaliczone;
int n, m, a, b;
char z;
cin>>t;
for(int i=0; i<t; i++)
{
cin>>n>>m;
bool dodatnideg[100001];
for(int i=1; i<=n; i++)
{
ujemnydeg[i]=0;
}
for(int j=0; j<m; j++)
{
cin>>a>>z>>b;
if(z=='>')
ujemnydeg[b]++;
else
dodatnideg[b]=1;
}zaliczone=0;
for(int i=1; i<=n; i++)
{
if(ujemnydeg[i]==n)
{cout<<"WYGRANA \n";
zaliczone=1;
break;}
}
if(zaliczone==0)
{
for(int i=1; i<=n; i++)
{
if(dodatnideg[i]==0)
{
zaliczone=1;
break;}
}
if(zaliczone==1)
cout<<"REMIS \n";
else
cout<<"PRZEGRANA \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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #include <iostream> using namespace std; int ujemnydeg[100001]; int main() {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); short t; bool zaliczone; int n, m, a, b; char z; cin>>t; for(int i=0; i<t; i++) { cin>>n>>m; bool dodatnideg[100001]; for(int i=1; i<=n; i++) { ujemnydeg[i]=0; } for(int j=0; j<m; j++) { cin>>a>>z>>b; if(z=='>') ujemnydeg[b]++; else dodatnideg[b]=1; }zaliczone=0; for(int i=1; i<=n; i++) { if(ujemnydeg[i]==n) {cout<<"WYGRANA \n"; zaliczone=1; break;} } if(zaliczone==0) { for(int i=1; i<=n; i++) { if(dodatnideg[i]==0) { zaliczone=1; break;} } if(zaliczone==1) cout<<"REMIS \n"; else cout<<"PRZEGRANA \n"; } } return 0; } |
English