# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
488522 | 2021-11-19T12:56:03 Z | rainboy | Kamenčići (COCI21_kamencici) | C | 0 ms | 588 KB |
#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] == 'R' ? 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |