#include <bits/stdc++.h>
#ifdef SIO
#define dbg(name) cerr << #name ": " << (name) << "\t"
#define nl cerr<<endl
#else
#define dbg(name)
#define nl
#endif
#define st first
#define nd second
#define pb push_back
#define rep(i,begin,end) for(__typeof(end) i = begin; i <= end; i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const ll nax = 1e18+33;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
if(n < 18) {
cout << "NIE\n";
return 0;
}
else {
dbg(n);
map<int,int> A,B,C;
rep(i,1,n) {
string s;
cin >> s;
int x = s[0]-'0';
if(s[1] == 'A') A[x]++;
else if(s[1] == 'B') B[x]++;
else C[x]++;
}
dbg("koniec petli");
rep(i,1,4) {
if(!(A.count(i) && B.count(i) && C.count(i))) {
cout<<"NIE\n";
exit(0);
}
}
if(A[5] >= 2 && B[5] >= 2 && C[5] >=2)
cout << "TAK\n";
else
cout << "NIE\n";
//for(auto x : A) cout << "A"<<x<< "\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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #include <bits/stdc++.h> #ifdef SIO #define dbg(name) cerr << #name ": " << (name) << "\t" #define nl cerr<<endl #else #define dbg(name) #define nl #endif #define st first #define nd second #define pb push_back #define rep(i,begin,end) for(__typeof(end) i = begin; i <= end; i++) using namespace std; using ll = long long; using pii = pair<int,int>; const ll nax = 1e18+33; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; if(n < 18) { cout << "NIE\n"; return 0; } else { dbg(n); map<int,int> A,B,C; rep(i,1,n) { string s; cin >> s; int x = s[0]-'0'; if(s[1] == 'A') A[x]++; else if(s[1] == 'B') B[x]++; else C[x]++; } dbg("koniec petli"); rep(i,1,4) { if(!(A.count(i) && B.count(i) && C.count(i))) { cout<<"NIE\n"; exit(0); } } if(A[5] >= 2 && B[5] >= 2 && C[5] >=2) cout << "TAK\n"; else cout << "NIE\n"; //for(auto x : A) cout << "A"<<x<< "\n"; } } |
English