# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
107820 | 2019-04-25T23:53:28 Z | luciocf | Calvinball championship (CEOI15_teams) | C++14 | 200 ms | 66560 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e4+10; const int mod = 1e6+7; int a[maxn]; int dp[maxn][maxn]; void add(int &a, int b) { a = (a+b)%mod; } int main(void) { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i <= n; i++) dp[0][i] = 1; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { add(dp[i][j], (1ll*j*dp[i-1][j])%mod); add(dp[i][j], dp[i-1][j+1]); } } int ans = 1, mx = 1; for (int i = 1; i <= n; i++) { for (int j = a[i]-1; j >= 1; j--) add(ans, dp[n-i][max(mx, j)]); mx = max(a[i], mx); } printf("%d\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 768 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 768 KB | Output is correct |
2 | Correct | 3 ms | 768 KB | Output is correct |
3 | Correct | 3 ms | 768 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 3328 KB | Output is correct |
2 | Correct | 7 ms | 3328 KB | Output is correct |
3 | Correct | 7 ms | 3328 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 8312 KB | Output is correct |
2 | Correct | 18 ms | 8284 KB | Output is correct |
3 | Correct | 20 ms | 8320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 198 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 200 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 174 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |