#include<bits/stdc++.h> #define ll long long #define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(20); #define inf 1000000000 #define INF 1000000000000000000LL #define mod 1000000007 #define VI vector<int> #define PII pair<int, int> #define st first #define nd second #define pb push_back #define mp make_pair #define endl '\n' #define REP(x, y) for(int x = 0; x < (y); ++x) #define FOR(x, y, z) for(int x = y; x <= (z); ++x) #define FORR(x, y, z) for(int x = y; x >= (z); --x) using namespace std; #define N 100007 int t,n,m,v1,v2; char c; bool czy1,czy2; int tab[N]; int tab1[N]; void czysc() { FOR(i,1,N) { tab[i]=0; tab1[i]=0; } czy1=false; czy2=false; } void solve() { czysc(); cin >> n >> m; FOR(i,1,m) { cin >> v1 >> c >> v2; if (c=='>') { tab1[v2]++; if (tab1[v2]==n) czy1=true; } else { tab[v2]++; } } FOR(i,1,n) { if (!tab[i]) { czy2=true; } } if (czy1) { cout << "WYGRANA" << endl; return; } if (!czy2) { cout << "PRZEGRANA" << endl; return; } cout << "REMIS" << endl; return; } int main() { boost cin >> t; while(t--) solve(); 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | #include<bits/stdc++.h> #define ll long long #define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(20); #define inf 1000000000 #define INF 1000000000000000000LL #define mod 1000000007 #define VI vector<int> #define PII pair<int, int> #define st first #define nd second #define pb push_back #define mp make_pair #define endl '\n' #define REP(x, y) for(int x = 0; x < (y); ++x) #define FOR(x, y, z) for(int x = y; x <= (z); ++x) #define FORR(x, y, z) for(int x = y; x >= (z); --x) using namespace std; #define N 100007 int t,n,m,v1,v2; char c; bool czy1,czy2; int tab[N]; int tab1[N]; void czysc() { FOR(i,1,N) { tab[i]=0; tab1[i]=0; } czy1=false; czy2=false; } void solve() { czysc(); cin >> n >> m; FOR(i,1,m) { cin >> v1 >> c >> v2; if (c=='>') { tab1[v2]++; if (tab1[v2]==n) czy1=true; } else { tab[v2]++; } } FOR(i,1,n) { if (!tab[i]) { czy2=true; } } if (czy1) { cout << "WYGRANA" << endl; return; } if (!czy2) { cout << "PRZEGRANA" << endl; return; } cout << "REMIS" << endl; return; } int main() { boost cin >> t; while(t--) solve(); return 0; } |