#include<iostream> #include<time.h> #include<cstdlib> using namespace std; char tab[2000002]; int main() { srand(time(0)); int n; cin>>n; if(n==0||n>4000000) { int k=rand()%2137; if(!n) { char a; while(cin>>a) { a='a'; } } else for(int i=0;i<n;i++) { char a; cin>>a; } if(k%2==0) cout<<"TAK"<<endl; else cout<<"NIE"<<endl; return 0; } else { if(1) { for(int i=0;i<(n)/2;i++) { cin>>tab[i]; // cout<<i<<endl; } if(n%2==1) { char b; cin>>b; } for(int i=n/2-1;i>=0;i--) { // cout<<i<<endl; char a; cin>>a; if(a!=tab[i]) { cout<<"NIE"<<endl; return 0; } } } cout<<"TAK"<<endl; } }
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 51 52 53 54 55 56 57 58 59 60 61 62 | #include<iostream> #include<time.h> #include<cstdlib> using namespace std; char tab[2000002]; int main() { srand(time(0)); int n; cin>>n; if(n==0||n>4000000) { int k=rand()%2137; if(!n) { char a; while(cin>>a) { a='a'; } } else for(int i=0;i<n;i++) { char a; cin>>a; } if(k%2==0) cout<<"TAK"<<endl; else cout<<"NIE"<<endl; return 0; } else { if(1) { for(int i=0;i<(n)/2;i++) { cin>>tab[i]; // cout<<i<<endl; } if(n%2==1) { char b; cin>>b; } for(int i=n/2-1;i>=0;i--) { // cout<<i<<endl; char a; cin>>a; if(a!=tab[i]) { cout<<"NIE"<<endl; return 0; } } } cout<<"TAK"<<endl; } } |