#include <iostream> #include <map> #include <string> using namespace std; int main() { int n; cin >> n; string round; map<string,int> round_index; int val = 1; for (int i = 1; i < 6; i++) { round = to_string(i); if (i == 5) { val = 2; } round_index[round + "A"] = val; round_index[round + "B"] = val; round_index[round + "C"] = val; } for (int i = 0; i < n; i++) { cin >> round; if (round_index[round] > 0) round_index[round] -= 1; } bool zeroed = true; for (auto it = round_index.begin(); it != round_index.end(); ++it ) { if (it->second > 0) { zeroed = false; } } if (zeroed) { cout << "TAK"; } else { cout << "NIE"; } 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 <map> #include <string> using namespace std; int main() { int n; cin >> n; string round; map<string,int> round_index; int val = 1; for (int i = 1; i < 6; i++) { round = to_string(i); if (i == 5) { val = 2; } round_index[round + "A"] = val; round_index[round + "B"] = val; round_index[round + "C"] = val; } for (int i = 0; i < n; i++) { cin >> round; if (round_index[round] > 0) round_index[round] -= 1; } bool zeroed = true; for (auto it = round_index.begin(); it != round_index.end(); ++it ) { if (it->second > 0) { zeroed = false; } } if (zeroed) { cout << "TAK"; } else { cout << "NIE"; } return 0; } |