//Marcin Wróbel #include <bits/stdc++.h> using namespace std; #define FOR(i,x,y) for(int i = (int)(x); i < (int)(y); ++i) #define FORE(i,x,y) for(int i = (int)(x); i <= (int)(y); ++i) #define FORD(i,x,y) for(int i = (int)(x); i >= (int)(y); --i) #define PB push_back typedef long long ll; typedef pair<int,int> pii; const int MAXN=27; int n; int a[MAXN]; int b[MAXN]; int main() { ios_base::sync_with_stdio(false);cin.tie(0); cin>>n; FOR(i,0,n) { char c; cin>>c; if(i%2) ++a[c-'a']; else ++b[c-'a']; } FOR(i,0,n) { char c; cin>>c; if(i%2) --a[c-'a']; else --b[c-'a']; } FOR(i,0,26) { if (a[i] != 0 || b[i] != 0) { cout<<"NIE\n"; return 0; } } cout<<"TAK\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 | //Marcin Wróbel #include <bits/stdc++.h> using namespace std; #define FOR(i,x,y) for(int i = (int)(x); i < (int)(y); ++i) #define FORE(i,x,y) for(int i = (int)(x); i <= (int)(y); ++i) #define FORD(i,x,y) for(int i = (int)(x); i >= (int)(y); --i) #define PB push_back typedef long long ll; typedef pair<int,int> pii; const int MAXN=27; int n; int a[MAXN]; int b[MAXN]; int main() { ios_base::sync_with_stdio(false);cin.tie(0); cin>>n; FOR(i,0,n) { char c; cin>>c; if(i%2) ++a[c-'a']; else ++b[c-'a']; } FOR(i,0,n) { char c; cin>>c; if(i%2) --a[c-'a']; else --b[c-'a']; } FOR(i,0,26) { if (a[i] != 0 || b[i] != 0) { cout<<"NIE\n"; return 0; } } cout<<"TAK\n"; return 0; } |