#include <cstdio>
#include <string>
#include <unordered_map>
#include <vector>
int main() {
const std::vector<std::pair<std::string, int> > contest = {
{"1A",1}, {"1B",1}, {"1C",1},
{"2A",1}, {"2B",1}, {"2C",1},
{"3A",1}, {"3B",1}, {"3C",1},
{"4A",1}, {"4B",1}, {"4C",1},
{"5A",2}, {"5B",2}, {"5C",2}};
std::unordered_map<std::string, int> tasks;
int N;
scanf("%d\n",&N);
for (int i=0; i<N; ++i) {
char task[10];
scanf("%s ", task);
tasks[std::string(task)]++;
}
bool ok = true;
for (auto x: contest) {
if (tasks[x.first] < x.second) {
ok = false;
}
}
if (ok) {
printf("TAK\n");
} else {
printf("NIE\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 | #include <cstdio> #include <string> #include <unordered_map> #include <vector> int main() { const std::vector<std::pair<std::string, int> > contest = { {"1A",1}, {"1B",1}, {"1C",1}, {"2A",1}, {"2B",1}, {"2C",1}, {"3A",1}, {"3B",1}, {"3C",1}, {"4A",1}, {"4B",1}, {"4C",1}, {"5A",2}, {"5B",2}, {"5C",2}}; std::unordered_map<std::string, int> tasks; int N; scanf("%d\n",&N); for (int i=0; i<N; ++i) { char task[10]; scanf("%s ", task); tasks[std::string(task)]++; } bool ok = true; for (auto x: contest) { if (tasks[x.first] < x.second) { ok = false; } } if (ok) { printf("TAK\n"); } else { printf("NIE\n"); } return 0; } |
English