Submission #884855

# Submission time Handle Problem Language Result Execution time Memory
884855 2023-12-08T14:52:37 Z Isam Kamenčići (COCI21_kamencici) C++17
0 / 70
0 ms 348 KB
#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
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 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 0 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 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -