This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |