#include <bits/stdc++.h>
#define int int64_t
#define ll int128_t
using namespace std;
int32_t main()
{
int n,k;
cin>>n>>k;
string v;
cin>>v;
int l=0,r=n-1,i=0;
int red1=0,red2=0;
while(l<r){
if(v[l]=='P'){
l++;
}
else if(v[r]=='P'){
r--;
}
else if(v[l+1]=='C'){
l++;
if(i%2==0){
red1++;
}
else{
red2++;
}
}
else{
r--;
if(i%2==0){
red1++;
}
else{
red2++;
}
}
i++;
if(red1==k || red2==k){
break;
}
}
if(red1!=k){
cout<<"DA"<<endl;
}
else{
cout<<"NE"<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |