#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n,k; cin>>n>>k;
string s; cin>>s;
int turn=0;
int l=0, r=n-1;
vector<int> peb(2, 0);
while (peb[0]<k&&l<r) {
if (turn==1&&s[l]=='C'&&s[r]=='C'&&peb[1]==k-1) {
cout<<"DA";
return 0;
}
if (s[l]=='P'&&s[r]=='P') {
if (s[l+1]=='C') {
l++;
} else {
r--;
}
} else if (s[l]=='P') {
l++;
} else if (s[r]=='P') {
r--;
} else {
if (s[l+1]=='C') {
l++;
} else {
r--;
}
peb[turn]++;
}
turn=!turn;
}
cout<<"NE";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |