이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |