#include <vector> #include <cstdio> using namespace std; vector<vector<int>> srcCount; vector<vector<int>> dstCount; char src[313131]; char dst[313131]; void countOccurrences(int n, char* c, vector<vector<int>>& counts) { for(int i=0;i<2;i++) { counts.push_back(vector<int>(26, 0)); } for(int i=0;i<n;i++) { counts[i%2][c[i]-'a']++; } } int main(int argc, char** argv) { int n; scanf("%d\n",&n); fgets(src,313131,stdin); fgets(dst,313131,stdin); countOccurrences(n, src, srcCount); countOccurrences(n, dst, dstCount); printf(srcCount == dstCount?"TAK\n":"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 | #include <vector> #include <cstdio> using namespace std; vector<vector<int>> srcCount; vector<vector<int>> dstCount; char src[313131]; char dst[313131]; void countOccurrences(int n, char* c, vector<vector<int>>& counts) { for(int i=0;i<2;i++) { counts.push_back(vector<int>(26, 0)); } for(int i=0;i<n;i++) { counts[i%2][c[i]-'a']++; } } int main(int argc, char** argv) { int n; scanf("%d\n",&n); fgets(src,313131,stdin); fgets(dst,313131,stdin); countOccurrences(n, src, srcCount); countOccurrences(n, dst, dstCount); printf(srcCount == dstCount?"TAK\n":"NIE\n"); return 0; } |