#include <unordered_map> #include <cstdio> #include <string> std::unordered_map<std::string, int> slots; int main() { for (char i='1'; i<='5'; ++i) for (char j='A'; j<='C'; ++j) { if (i == '5') { slots.emplace(std::string(1, i) + std::string(1, j), 2); } else { slots.emplace(std::string(1, i) + std::string(1, j), 1); } } int n; char token[3]; int s = 0; scanf("%d", &n); for (int i=0; i<n; ++i) { scanf("%2s", token); if (--slots[token] == 0) s+=1; } printf("%s\n", (s==15 ? "TAK" : "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 | #include <unordered_map> #include <cstdio> #include <string> std::unordered_map<std::string, int> slots; int main() { for (char i='1'; i<='5'; ++i) for (char j='A'; j<='C'; ++j) { if (i == '5') { slots.emplace(std::string(1, i) + std::string(1, j), 2); } else { slots.emplace(std::string(1, i) + std::string(1, j), 1); } } int n; char token[3]; int s = 0; scanf("%d", &n); for (int i=0; i<n; ++i) { scanf("%2s", token); if (--slots[token] == 0) s+=1; } printf("%s\n", (s==15 ? "TAK" : "NIE")); return 0; } |