#include <iostream>
using namespace std;
int_fast16_t n, tab[16], i;
char c;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> n;
while (n--) {
cin >> i >> c;
tab[5 * (c - 'A') + i]++;
}
for (int_fast16_t j = 1; j < 16; j++) {
if ((j % 5 == 0 && tab[j] < 2) || (j % 5 != 0 && tab[j] < 1)) {
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 | #include <iostream> using namespace std; int_fast16_t n, tab[16], i; char c; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n; while (n--) { cin >> i >> c; tab[5 * (c - 'A') + i]++; } for (int_fast16_t j = 1; j < 16; j++) { if ((j % 5 == 0 && tab[j] < 2) || (j % 5 != 0 && tab[j] < 1)) { cout << "NIE\n"; return 0; } } cout << "TAK\n"; return 0; } |
English