#include<iostream> #include<set> using namespace std; int main() { ios_base::sync_with_stdio(0); int n; cin>>n; multiset<pair<char,char> > secik; string zad; while(n--) { cin>>zad; secik.insert({zad[0],zad[1]}); } for(char i='1' ; i<='5' ; i++) for(char j='A' ; j<='C' ; j++) { pair<char,char> h; h.first=i; h.second=j; if(i=='5') { if(secik.count(h)>=2) continue; else {cout<<"NIE"<<endl;return 0;} } else { if(secik.count(h)>=1) continue; else {cout<<"NIE"<<endl;return 0;} } } cout<<"TAK"<<endl; 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 | #include<iostream> #include<set> using namespace std; int main() { ios_base::sync_with_stdio(0); int n; cin>>n; multiset<pair<char,char> > secik; string zad; while(n--) { cin>>zad; secik.insert({zad[0],zad[1]}); } for(char i='1' ; i<='5' ; i++) for(char j='A' ; j<='C' ; j++) { pair<char,char> h; h.first=i; h.second=j; if(i=='5') { if(secik.count(h)>=2) continue; else {cout<<"NIE"<<endl;return 0;} } else { if(secik.count(h)>=1) continue; else {cout<<"NIE"<<endl;return 0;} } } cout<<"TAK"<<endl; return 0; } |