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<bits/stdc++.h>
#ifdef DEBUG
#include "debug.h"
#else
#define debug(...) void(37)
#endif
using namespace std;
signed main(){
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int N, K;
string s;
cin >> N >> K >> s;
s = ' ' + s;
int l = 1, r = N, gottena(0), gottenb(0);
bool que = true;
while(l <= r && max(gottena, gottenb) < K){
if(s[l] == 'C'){
if(que) gottena += s[r] == 'C';
else gottenb += s[r] == 'C';
--r;
}else{
if(que) gottena += s[l] == 'C';
else gottenb += s[l] == 'C';
++l;
}
que ^= 1;
}
cout << (gottena == K ? "NE" : "DA") << '\n';
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... |