?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
187442212 |
Practice: DaiRuiChen007 |
1730D - 23 | C++14 (GCC 6-32) | Accepted | 46 ms | 344 KB | 2022-12-31 15:00:56 | 2022-12-31 15:00:56 |
// LUOGU_RID: 98382671 #include<bits/stdc++.h> #define pcc pair<char,char> using namespace std; const int MAXN=1e5+1; char s[MAXN],t[MAXN]; inline void solve() { int n; scanf("%d%s%s",&n,s+1,t+1); map <pcc,int> cnt; for(int i=1,j=n;i<=n;++i,--j) ++cnt[make_pair(min(s[i],t[j]),max(s[i],t[j]))]; bool eq=false; for(auto u:cnt) { if(u.second%2==0) continue; if(u.first.first==u.first.second&&!eq) eq=true; else { puts("NO"); return ; } } puts((eq&&n%2!=0)||(!eq&&n%2==0)?"YES":"NO"); } signed main() { int T; scanf("%d",&T); while(T--) solve(); return 0; }
?
?
?
?