Submission #920596

# Submission time Handle Problem Language Result Execution time Memory
920596 2024-02-02T18:40:01 Z SuPythony Kamenčići (COCI21_kamencici) C++17
0 / 70
1 ms 348 KB
#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
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -