#include "bits/stdc++.h"
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) FOR(i, 0, (n) - 1)
// Ignacy Boehlke
int main() {
int n;
scanf("%d", &n);
char r, t;
vvi arr(5, vi(3));
while (n--) {
scanf(" %c%c", &r, &t);
++arr[r - '1'][t - 'A'];
}
bool ok = true;
REP(i, 4) REP(j, 3) ok = ok && arr[i][j];
REP(j, 3) ok = ok && (arr[4][j] >= 2);
printf(ok ? "TAK\n" : "NIE\n");
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; #define FOR(i, a, b) for (int i = (a); i <= (b); ++i) #define REP(i, n) FOR(i, 0, (n) - 1) // Ignacy Boehlke int main() { int n; scanf("%d", &n); char r, t; vvi arr(5, vi(3)); while (n--) { scanf(" %c%c", &r, &t); ++arr[r - '1'][t - 'A']; } bool ok = true; REP(i, 4) REP(j, 3) ok = ok && arr[i][j]; REP(j, 3) ok = ok && (arr[4][j] >= 2); printf(ok ? "TAK\n" : "NIE\n"); } |
English