#include <bits/stdc++.h> using namespace std; typedef long long ll; string solve(const vector<string> A) { map<string, int> mp; for(auto it: A) mp[it]++; vector<string> first = { "1A", "1B", "1C", "2A", "2B", "2C", "3A", "3B", "3C", "4A", "4B", "4C", }; vector<string> second = { "5A", "5B", "5C" }; for(auto it: first) { if(mp[it] < 1) return "NIE"; } for(auto it: second) { if(mp[it] < 2) return "NIE"; } return "TAK"; } int main(int argc, char const *argv[]) { int n; cin >> n; vector<string> A(n); for(int i = 0; i < n; i++) { cin >> A[i]; } cout << solve(A) << endl; 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 <bits/stdc++.h> using namespace std; typedef long long ll; string solve(const vector<string> A) { map<string, int> mp; for(auto it: A) mp[it]++; vector<string> first = { "1A", "1B", "1C", "2A", "2B", "2C", "3A", "3B", "3C", "4A", "4B", "4C", }; vector<string> second = { "5A", "5B", "5C" }; for(auto it: first) { if(mp[it] < 1) return "NIE"; } for(auto it: second) { if(mp[it] < 2) return "NIE"; } return "TAK"; } int main(int argc, char const *argv[]) { int n; cin >> n; vector<string> A(n); for(int i = 0; i < n; i++) { cin >> A[i]; } cout << solve(A) << endl; return 0; } |