Submission #488521

#TimeUsernameProblemLanguageResultExecution timeMemory
488521rainboyKamenčići (COCI21_kamencici)C11
0 / 70
1 ms588 KiB
#include <stdio.h> #define N 350 int main() { static char cc[N + 1]; static int pp[N], dp[N][N + 1][N + 1]; 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 <= c; 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)

Main.c: In function 'main':
Main.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d%d%s", &n, &k_, cc);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...