# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44747 | 2018-04-06T04:33:27 Z | RayaBurong25_1 | Calvinball championship (CEOI15_teams) | C++17 | 79 ms | 32492 KB |
#include <stdio.h> #define MOD 1000007LL int n; int a[10005]; long long dp[1005][2005]; long long max(long long a, long long b) { return (a > b)?a:b; } int main() { scanf("%d", &n); int i, j; for (i = 0; i < n; i++) scanf("%d", &a[i]); for (i = 0; i <= n; i++) { for (j = 1; j <= 2*n - i; j++) { if (i == 0) dp[i][j] = 1LL; else dp[i][j] = (1LL*j*dp[i - 1][j] + dp[i - 1][j + 1])%MOD; // if (j <= 2*n - i) // printf("%d ", dp[i][j]); } // printf("\n"); } long long ans = 1; int mx = 0; for (i = 0; i < n; i++) { for (j = 1; j < a[i]; j++) ans = (ans + dp[(n - 1) - i][max(mx, j)])%MOD; mx = max(mx, a[i]); } printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 476 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Correct | 2 ms | 504 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 536 KB | Output is correct |
3 | Correct | 2 ms | 668 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 668 KB | Output is correct |
2 | Correct | 2 ms | 676 KB | Output is correct |
3 | Correct | 2 ms | 676 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1016 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1016 KB | Output is correct |
2 | Correct | 2 ms | 1016 KB | Output is correct |
3 | Correct | 2 ms | 1020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 5504 KB | Output is correct |
2 | Correct | 6 ms | 5528 KB | Output is correct |
3 | Correct | 6 ms | 5532 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 15392 KB | Output is correct |
2 | Correct | 14 ms | 15404 KB | Output is correct |
3 | Correct | 19 ms | 15404 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 78 ms | 32292 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 54 ms | 32396 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 79 ms | 32492 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |