#include<bits/stdc++.h> using namespace std; using LL = long long; using D = double; #define f1 first #define f2 second #define randint(a, b) uniform_int_distribution<int>{a, b}(gen) #ifdef LOC void OUT() {cout << '\n';} template<class H, class ... T> void OUT(H h, T ... t) { cout << h << ' '; OUT(t...); } #define P(...) cout << "[" << #__VA_ARGS__ << "] ", OUT(__VA_ARGS__) #else #define P(...) #define OUT(...) #endif //mt19937 gen; int n; string a, b; int xd[256][2]; int main(int, char ** /*args*/) { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int t = 0; t < 2; ++t) { cin >> a; for(int i = 0; i < n; ++i) { ++xd[(int)a[i]][i % 2]; } for(int i = 0; i < 256; ++i) for(int j = 0; j < 2; ++j) xd[i][j] = -xd[i][j]; } for(int i = 0; i < 256; ++i) for(int j = 0; j < 2; ++j) if(xd[i][j] != 0) { cout << "NIE"; return 0; } cout << "TAK"; 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 41 42 43 44 45 46 47 | #include<bits/stdc++.h> using namespace std; using LL = long long; using D = double; #define f1 first #define f2 second #define randint(a, b) uniform_int_distribution<int>{a, b}(gen) #ifdef LOC void OUT() {cout << '\n';} template<class H, class ... T> void OUT(H h, T ... t) { cout << h << ' '; OUT(t...); } #define P(...) cout << "[" << #__VA_ARGS__ << "] ", OUT(__VA_ARGS__) #else #define P(...) #define OUT(...) #endif //mt19937 gen; int n; string a, b; int xd[256][2]; int main(int, char ** /*args*/) { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int t = 0; t < 2; ++t) { cin >> a; for(int i = 0; i < n; ++i) { ++xd[(int)a[i]][i % 2]; } for(int i = 0; i < 256; ++i) for(int j = 0; j < 2; ++j) xd[i][j] = -xd[i][j]; } for(int i = 0; i < 256; ++i) for(int j = 0; j < 2; ++j) if(xd[i][j] != 0) { cout << "NIE"; return 0; } cout << "TAK"; return 0; } |