#include <bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define BOOST ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
#define PI 3.14159265359
using namespace std;
typedef long long ll;
constexpr ll MOD = 1000000007, hot = 29;
constexpr ll FOX = 1234567891, cute = 1007;
constexpr ll MEGAN = 1000000009, liv = 107;
constexpr int MXN = 2000000+7 + 10, CZAPA = (1<<20), INF = 1000000000;
int tab[10][10];
int main(){
BOOST;
int n;
cin>> n;
while(n--){
string s;
cin>> s;
int a = int(s[0] - '0');
int b = int(s[1] - 'A' + 1);
tab[a][b]++;
}
bool ans = true;
tab[5][1]--;
tab[5][2]--;
tab[5][3]--;
for(int i=1; i<=5; i++){
for(int j=1; j<=3; j++){
if(tab[i][j] < 1) ans = false;
}
}
if(ans)
cout<< "TAK\n";
else
cout<< "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 40 41 42 43 44 45 46 | #include <bits/stdc++.h> #define st first #define nd second #define pb push_back #define BOOST ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); #define PI 3.14159265359 using namespace std; typedef long long ll; constexpr ll MOD = 1000000007, hot = 29; constexpr ll FOX = 1234567891, cute = 1007; constexpr ll MEGAN = 1000000009, liv = 107; constexpr int MXN = 2000000+7 + 10, CZAPA = (1<<20), INF = 1000000000; int tab[10][10]; int main(){ BOOST; int n; cin>> n; while(n--){ string s; cin>> s; int a = int(s[0] - '0'); int b = int(s[1] - 'A' + 1); tab[a][b]++; } bool ans = true; tab[5][1]--; tab[5][2]--; tab[5][3]--; for(int i=1; i<=5; i++){ for(int j=1; j<=3; j++){ if(tab[i][j] < 1) ans = false; } } if(ans) cout<< "TAK\n"; else cout<< "NIE\n"; return 0; } |
English