#include <iostream> //#include <cstdio> #include <string> #include <map> using namespace std; struct counter_t { int val; counter_t(): val(0){} }; int n; map<string, counter_t> slots; int main() { std::ios_base::sync_with_stdio(false); cin >> n; string temp; for (int i = 0; i < n; i++) { cin >> temp; slots[temp].val++; } string divisions[] = {"A", "B", "C"}; for (int round = 1; round <= 5; round++) { for(string a: divisions) { string ex_id = to_string(round) + a; int number_of_ex = slots[ex_id].val; // cout << "ex_id: " << ex_id << " number_of_ex: " << number_of_ex << endl; if (round < 5) { if (number_of_ex < 1 ) { cout << "NIE\n"; return 0; } } else { if ( number_of_ex < 2) { cout << "NIE\n"; return 0; } } } } cout << "TAK\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 45 46 47 48 49 50 51 52 53 54 55 | #include <iostream> //#include <cstdio> #include <string> #include <map> using namespace std; struct counter_t { int val; counter_t(): val(0){} }; int n; map<string, counter_t> slots; int main() { std::ios_base::sync_with_stdio(false); cin >> n; string temp; for (int i = 0; i < n; i++) { cin >> temp; slots[temp].val++; } string divisions[] = {"A", "B", "C"}; for (int round = 1; round <= 5; round++) { for(string a: divisions) { string ex_id = to_string(round) + a; int number_of_ex = slots[ex_id].val; // cout << "ex_id: " << ex_id << " number_of_ex: " << number_of_ex << endl; if (round < 5) { if (number_of_ex < 1 ) { cout << "NIE\n"; return 0; } } else { if ( number_of_ex < 2) { cout << "NIE\n"; return 0; } } } } cout << "TAK\n"; return 0; } |