Submission #499534

# Submission time Handle Problem Language Result Execution time Memory
499534 2021-12-28T14:54:54 Z AramJ Kamenčići (COCI21_kamencici) C++14
0 / 70
1 ms 204 KB
#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
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -