#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
vector<int>V(15,0);
int n;
cin>>n;
while(n--)
{
string S;
cin>>S;
int p=3*(S[0]-'0')-3;
if(S[1]=='B')
p+=1;
else if(S[1]=='C')
p+=2;
if(p<12)
V[p]=1;
else
{
if(V[p]==0)
V[p]=2;
else if(V[p]==2)
V[p]=1;
}
}
bool zestaw=true;
for(int i=0;i<15;i++)
if(V[i]!=1)
zestaw=false;
if(zestaw==true)
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 | #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); vector<int>V(15,0); int n; cin>>n; while(n--) { string S; cin>>S; int p=3*(S[0]-'0')-3; if(S[1]=='B') p+=1; else if(S[1]=='C') p+=2; if(p<12) V[p]=1; else { if(V[p]==0) V[p]=2; else if(V[p]==2) V[p]=1; } } bool zestaw=true; for(int i=0;i<15;i++) if(V[i]!=1) zestaw=false; if(zestaw==true) cout<<"TAK\n"; else cout<<"NIE\n"; return 0; } |
English