#include<iostream> using namespace std; inline void readLine(int& baj, char& sign, int& bi); int main() { ios_base::sync_with_stdio(false); int t, n, m, bi, ba, maxBaj, totalBi; char sign; maxBaj = totalBi = 0; cin >> t; for (int i = 0; i < t; i++) { cin >> n; cin >> m; if (m < n) { readLine(ba, sign, bi); cout << "REMIS" << endl; for (int j = 0; j < m; j++) { readLine(ba, sign, bi); } continue; } bool* bitek = (bool*)calloc(n, sizeof(bool)); int* baj = (int*)calloc(n, sizeof(int)); int maxBaj = 0; int totalBi = 0; for (int j = 0; j < m; j++) { readLine(ba, sign, bi); ba--; bi--; if (sign == '>') { baj[bi]++; if (baj[bi] > maxBaj) maxBaj = baj[bi]; } else { if (!bitek[bi]) { totalBi++; } bitek[bi] = true; } } if (maxBaj == n) { cout << "WYGRANA" << endl; } else if (totalBi == n) { cout << "PRZEGRANA" << endl; } else { cout << "REMIS" << endl; } } return 0; } inline void readLine(int& baj, char& sign, int& bi) { cin >> baj; cin >> sign; cin >> bi; }
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 | #include<iostream> using namespace std; inline void readLine(int& baj, char& sign, int& bi); int main() { ios_base::sync_with_stdio(false); int t, n, m, bi, ba, maxBaj, totalBi; char sign; maxBaj = totalBi = 0; cin >> t; for (int i = 0; i < t; i++) { cin >> n; cin >> m; if (m < n) { readLine(ba, sign, bi); cout << "REMIS" << endl; for (int j = 0; j < m; j++) { readLine(ba, sign, bi); } continue; } bool* bitek = (bool*)calloc(n, sizeof(bool)); int* baj = (int*)calloc(n, sizeof(int)); int maxBaj = 0; int totalBi = 0; for (int j = 0; j < m; j++) { readLine(ba, sign, bi); ba--; bi--; if (sign == '>') { baj[bi]++; if (baj[bi] > maxBaj) maxBaj = baj[bi]; } else { if (!bitek[bi]) { totalBi++; } bitek[bi] = true; } } if (maxBaj == n) { cout << "WYGRANA" << endl; } else if (totalBi == n) { cout << "PRZEGRANA" << endl; } else { cout << "REMIS" << endl; } } return 0; } inline void readLine(int& baj, char& sign, int& bi) { cin >> baj; cin >> sign; cin >> bi; } |