#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <limits>
#include <vector>
int main() {
auto maxSize = std::numeric_limits<std::streamsize>::max();
char buffer[8];
std::vector<int> scores[2];
std::vector<int>* sign = scores - 30;
std::ios_base::sync_with_stdio(false);
int t;
std::cin >> t;
while (t--) {
int n, m;
std::cin >> n >> m;
for (auto&& v : scores) {
v.assign(n, 0);
}
while (m--) {
char w;
std::cin.ignore(maxSize, ' ').get(w).ignore().getline(buffer, 8, '\n');
sign[w >> 1][std::atoi(buffer) - 1]++;
}
if (std::find(scores[0].begin(), scores[0].end(), 0) == scores[0].end())
std::cout << "PRZEGRANA\n";
else if (std::find(scores[1].begin(), scores[1].end(), n) == scores[1].end())
std::cout << "REMIS\n";
else
std::cout << "WYGRANA\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 | #include <algorithm> #include <cstdlib> #include <iostream> #include <limits> #include <vector> int main() { auto maxSize = std::numeric_limits<std::streamsize>::max(); char buffer[8]; std::vector<int> scores[2]; std::vector<int>* sign = scores - 30; std::ios_base::sync_with_stdio(false); int t; std::cin >> t; while (t--) { int n, m; std::cin >> n >> m; for (auto&& v : scores) { v.assign(n, 0); } while (m--) { char w; std::cin.ignore(maxSize, ' ').get(w).ignore().getline(buffer, 8, '\n'); sign[w >> 1][std::atoi(buffer) - 1]++; } if (std::find(scores[0].begin(), scores[0].end(), 0) == scores[0].end()) std::cout << "PRZEGRANA\n"; else if (std::find(scores[1].begin(), scores[1].end(), n) == scores[1].end()) std::cout << "REMIS\n"; else std::cout << "WYGRANA\n"; } return 0; } |
English