#pragma GCC optimize("O3") #include <bits/stdc++.h> int problem[5][3]; int32_t main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL); int ideas_number; std::cin >> ideas_number; for (int i = 0; i < ideas_number; ++i) { std::string idea; std::cin >> idea; ++problem[(int)idea[0] - 49][(int)idea[1] - 65]; } for (int i = 0; i < 4; ++i) { if (problem[i][0] < 1 || problem[i][1] < 1 || problem[i][2] < 1) { std::cout << "NIE\n"; return 0; } } if (problem[4][0] < 2 || problem[4][1] < 2 || problem[4][2] < 2) { std::cout << "NIE\n"; return 0; } std::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 | #pragma GCC optimize("O3") #include <bits/stdc++.h> int problem[5][3]; int32_t main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL); int ideas_number; std::cin >> ideas_number; for (int i = 0; i < ideas_number; ++i) { std::string idea; std::cin >> idea; ++problem[(int)idea[0] - 49][(int)idea[1] - 65]; } for (int i = 0; i < 4; ++i) { if (problem[i][0] < 1 || problem[i][1] < 1 || problem[i][2] < 1) { std::cout << "NIE\n"; return 0; } } if (problem[4][0] < 2 || problem[4][1] < 2 || problem[4][2] < 2) { std::cout << "NIE\n"; return 0; } std::cout << "TAK\n"; return 0; } |