Submission #696556

# Submission time Handle Problem Language Result Execution time Memory
696556 2023-02-06T20:16:39 Z Elvin_Fritl Kamenčići (COCI21_kamencici) C++17
0 / 70
0 ms 212 KB
#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(red2==k){
        cout<<"NE"<<endl;
    }
    else{
        cout<<"DA"<<endl;
    }



    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -