Submission
Status:
[PPPPPPPPPPPPPPPPPPPP]
Score: 100
User: KotatsuCat
Problemset: B.Shuffle
Language: cpp
Time: 0.050 second
Submitted On: 2025-03-06 21:00:39
#include <iostream>
#include <string>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while(T--){
int N;
cin >> N;
string S;
cin >> S;
S+='N';
int cnt = 0, ans = 0;
for(int i=0;i<N;i++){
if(S[i]=='N' || S[i]=='K') ans+=cnt;
else ++cnt;
}
if(ans%2==1) cout << "YES\n";
else cout << "NO\n";
}
return 0;
}