#include <iostream>
#include <algorithm>
using namespace std;
int t, n, m;
int a, b;
char w;
int stats[20][2][100001];
int main()
{
ios_base::sync_with_stdio(false);
cin >> t;
for (int tt = 0; tt < t; ++tt) {
cin >> n >> m;
for (int i = 0; i < m; ++i) {
cin >> a >> w >> b;
if (w == '>') {
//cout << tt << " a " << a-1 << " " << stats[tt][0][a-1] << endl;
stats[tt][0][a-1]++;
} else {
//cout << tt << " b " << b-1 << " " << stats[tt][0][b-1] << endl;
stats[tt][1][b-1]++;
}
}
sort(stats[tt][0], stats[tt][0] + n);
sort(stats[tt][1], stats[tt][1] + n);
//cout << stats[tt][0][0] << stats[tt][0][1] << endl;
if (stats[tt][0][0] > 0) {
cout << "WYGRANA\n";
} else if (stats[tt][1][0] > 0 ) {
cout << "PRZEGRANA\n";
} else {
cout << "REMIS\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 | #include <iostream> #include <algorithm> using namespace std; int t, n, m; int a, b; char w; int stats[20][2][100001]; int main() { ios_base::sync_with_stdio(false); cin >> t; for (int tt = 0; tt < t; ++tt) { cin >> n >> m; for (int i = 0; i < m; ++i) { cin >> a >> w >> b; if (w == '>') { //cout << tt << " a " << a-1 << " " << stats[tt][0][a-1] << endl; stats[tt][0][a-1]++; } else { //cout << tt << " b " << b-1 << " " << stats[tt][0][b-1] << endl; stats[tt][1][b-1]++; } } sort(stats[tt][0], stats[tt][0] + n); sort(stats[tt][1], stats[tt][1] + n); //cout << stats[tt][0][0] << stats[tt][0][1] << endl; if (stats[tt][0][0] > 0) { cout << "WYGRANA\n"; } else if (stats[tt][1][0] > 0 ) { cout << "PRZEGRANA\n"; } else { cout << "REMIS\n"; } } return 0; } |
English