#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |