Submission #482197

#TimeUsernameProblemLanguageResultExecution timeMemory
482197rainboyTrener (COCI20_trener)C11
110 / 110
1371 ms6456 KiB
#include <stdio.h> #include <string.h> #define N 50 #define K 1500 #define MD 1000000007 int main() { static char cc[N][K][N + 1]; static int dp[N][K]; int n, k, h, h_, i, ans; scanf("%d%d", &n, &k); for (i = 0; i < n; i++) for (h = 0; h < k; h++) scanf("%s", cc[i][h]); for (h = 0; h < k; h++) dp[0][h] = 1; for (i = 0; i + 1 < n; i++) for (h = 0; h < k; h++) for (h_ = 0; h_ < k; h_++) if (strncmp(cc[i + 1][h_], cc[i][h], i + 1) == 0 || strncmp(cc[i + 1][h_] + 1, cc[i][h], i + 1) == 0) dp[i + 1][h_] = (dp[i + 1][h_] + dp[i][h]) % MD; ans = 0; for (h = 0; h < k; h++) ans = (ans + dp[n - 1][h]) % MD; printf("%d\n", ans); return 0; }

Compilation message (stderr)

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