# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44746 | 2018-04-06T04:30:08 Z | RayaBurong25_1 | Calvinball championship (CEOI15_teams) | C++17 | 311 ms | 32324 KB |
#include <stdio.h> #define MOD 1000000007LL 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; j++) { if (i == 0) dp[i][j] = 1LL; else if (j + 1 <= 2*n) 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("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 476 KB | Output is correct |
3 | Correct | 2 ms | 476 KB | Output is correct |
4 | Correct | 2 ms | 476 KB | Output is correct |
5 | Correct | 2 ms | 476 KB | Output is correct |
6 | Correct | 2 ms | 476 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 476 KB | Output is correct |
2 | Correct | 2 ms | 680 KB | Output is correct |
3 | Correct | 2 ms | 680 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 680 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1124 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1124 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 6500 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 42 ms | 16208 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 288 ms | 32228 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 168 ms | 32324 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 | 311 ms | 32324 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |