#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define mid (l+r)/2
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<vi> vvi;
int main(){
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n;
string s;
cin >> n;
string w[2][2];
cin >> s;
for(int i=0; i<n; i++)
w[0][i&1].pb(s[i]);
cin >> s;
for(int i=0; i<n; i++)
w[1][i&1].pb(s[i]);
for(int i=0; i<2; i++)
for(int j=0; j<2; j++)
sort(all(w[i][j]));
bool ok = 1;
if(w[0][0] != w[1][0] || w[0][1] != w[1][1])
ok = 0;
if(ok)
cout << "TAK";
else
cout << "NIE";
}
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 | #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define mid (l+r)/2 typedef long long ll; typedef long double ld; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<ii> vii; typedef vector<vi> vvi; int main(){ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n; string s; cin >> n; string w[2][2]; cin >> s; for(int i=0; i<n; i++) w[0][i&1].pb(s[i]); cin >> s; for(int i=0; i<n; i++) w[1][i&1].pb(s[i]); for(int i=0; i<2; i++) for(int j=0; j<2; j++) sort(all(w[i][j])); bool ok = 1; if(w[0][0] != w[1][0] || w[0][1] != w[1][1]) ok = 0; if(ok) cout << "TAK"; else cout << "NIE"; } |
English