#include <iostream> #include <vector> #include <algorithm> #include <climits> using namespace std; #define MP make_pair #define ST first #define ND second void solve(){ int n, m; cin >> n >> m; int A[n+1], B[n+1]; //number of defeats for(int i=1; i<=n; i++){ A[i] = B[i] = 0; } int a, b; char w; string result = "REMIS"; for(int i=0; i<m; i++){ cin >> a >> w >> b; if(w == '<'){ if(++A[a] == n) result = "PRZEGRANA"; } else{ if(++B[b] == n) result = "WYGRANA"; } } cout << result << endl; } int main(){ ios_base::sync_with_stdio(false); int z; cin >> z; while(z--) 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 | #include <iostream> #include <vector> #include <algorithm> #include <climits> using namespace std; #define MP make_pair #define ST first #define ND second void solve(){ int n, m; cin >> n >> m; int A[n+1], B[n+1]; //number of defeats for(int i=1; i<=n; i++){ A[i] = B[i] = 0; } int a, b; char w; string result = "REMIS"; for(int i=0; i<m; i++){ cin >> a >> w >> b; if(w == '<'){ if(++A[a] == n) result = "PRZEGRANA"; } else{ if(++B[b] == n) result = "WYGRANA"; } } cout << result << endl; } int main(){ ios_base::sync_with_stdio(false); int z; cin >> z; while(z--) solve(); return 0; } |