| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 488523 | rainboy | Kamenčići (COCI21_kamencici) | C11 | 50 ms | 85924 KiB | 
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 <stdio.h>
#define N	350
int main() {
	static char cc[N + 1];
	static int pp[N], dp[N][N + 1][N];
	int n, k_, i, j, k;
	scanf("%d%d%s", &n, &k_, cc);
	for (i = 0; i < n; i++)
		pp[i] = cc[i] == 'C' ? 1 : 0;
	for (i = 1; i < n; i++)
		pp[i] += pp[i - 1];
	for (i = n - 1; i >= 0; i--)
		for (j = i; j <= n; j++) {
			int c = (i == 0 ? 0 : pp[i - 1]) + pp[n - 1] - (j == 0 ? 0 : pp[j - 1]);
			for (k = 0; k < k_; k++)
				dp[i][j][k] = c - k >= k_ ? 1 : !(dp[i + 1][j][c - k] && dp[i][j - 1][c - k]);
		}
	printf(dp[0][n][0] ? "DA\n" : "NE\n");
	return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
