# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
482197 | 2021-10-23T15:50:26 Z | rainboy | Trener (COCI20_trener) | C | 1371 ms | 6456 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 972 KB | Output is correct |
2 | Correct | 7 ms | 972 KB | Output is correct |
3 | Correct | 7 ms | 1036 KB | Output is correct |
4 | Correct | 7 ms | 972 KB | Output is correct |
5 | Correct | 8 ms | 1068 KB | Output is correct |
6 | Correct | 8 ms | 972 KB | Output is correct |
7 | Correct | 6 ms | 1064 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 9 ms | 972 KB | Output is correct |
6 | Correct | 7 ms | 972 KB | Output is correct |
7 | Correct | 7 ms | 1036 KB | Output is correct |
8 | Correct | 7 ms | 972 KB | Output is correct |
9 | Correct | 8 ms | 1068 KB | Output is correct |
10 | Correct | 8 ms | 972 KB | Output is correct |
11 | Correct | 6 ms | 1064 KB | Output is correct |
12 | Correct | 1205 ms | 6112 KB | Output is correct |
13 | Correct | 1233 ms | 6212 KB | Output is correct |
14 | Correct | 1254 ms | 6400 KB | Output is correct |
15 | Correct | 1213 ms | 6240 KB | Output is correct |
16 | Correct | 1058 ms | 6456 KB | Output is correct |
17 | Correct | 1324 ms | 6272 KB | Output is correct |
18 | Correct | 1324 ms | 6380 KB | Output is correct |
19 | Correct | 1325 ms | 6304 KB | Output is correct |
20 | Correct | 1371 ms | 6208 KB | Output is correct |
21 | Correct | 1328 ms | 6236 KB | Output is correct |
22 | Correct | 1043 ms | 6228 KB | Output is correct |