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 <iostream>
using namespace std;
int main(){
int n;
int k;
cin>>n>>k;
string c;
cin>>c;
string h=c;
bool f=true;
bool d=false;
int a=0;
int b=0;
for(int i=0;i<n;i++){
if(f==true){
if(c[i]=='C'){
a+=1;
f=false;
}
}
else if(f==false){
if(c[i]=='C'){
b+=1;
f=true;
}
}
if(b>=k&&a<k){
cout<<"DA";
d=true;
break;
}
}
if(d==false) {
c=h;
a=0;
b=0;
f=true;
for(int i=0;i<n;i++){
if(f==true){
if(c[i]=='C'){
a++;
f=false;
c[i]=' ';
}
}
if(f==false){
if(c[n-1-i]=='C'){
b++;
c[n-1-i]=' ';
}
}
if(b>=k&&a<k){
d=true;
cout<<"DA";
break;
}
}
if(d==false) {
d=false;
c=h;
a=0;
b=0;
f=true;
for(int i=0;i<n;i++){
if(f==true){
if(c[n-1-i]=='C'){
a++;
f=false;
c[n-1-i]=' ';
}
if(f==true){
f=false;
}
}
else if(f==false){
if(c[i]=='C'){
b++;
c[i]=' ';
}
}
if(b>=k&&a<k){
d=true;
cout<<"DA";
break;
}
}
}
}
if(d==false) {
d=false;
c=h;
a=0;
b=0;
f=true;
for(int i=0;i<n;i++){
if(f==true){
if(c[n-1-i]=='C'){
a+=1;
f=false;
}
}
if(f==false){
if(c[n-1-i]=='C'){
b+=1;
f=true;
}
}
if(b>=k&&a<k){
d=true;
cout<<"DA";
break;
}
}
if(d==false){
cout<<"NE";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |