# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
54387 | 2018-07-03T09:46:30 Z | Costin Andrei Oncescu(#1303) | Calvinball championship (CEOI15_teams) | C++11 | 158 ms | 1108 KB |
#include<bits/stdc++.h> using namespace std; int ans, a[10009], b[10009], N, dp[2][10009]; const int mod = 1e6 + 7; int main () { //freopen ("input", "r", stdin); //freopen ("output", "w", stdout); scanf ("%d", &N), ans = 1; for (int i=1; i<=N; i++) scanf ("%d", &a[i]), b[i] = max (b[i - 1], a[i]); for (int i=1; i<=N; i++) dp[N & 1][i] = 1; for (int i=N; i>=1; i--) { if (i != N) { int curr = (i & 1), nxt = curr ^ 1; for (int j=1; j<=i; j++) dp[curr][j] = (1LL * dp[nxt][j] * j + dp[nxt][j + 1]) % mod; } for (int j=1; j<a[i]; j++) ans += dp[i & 1][max (b[i - 1], j)]; } printf ("%d\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 2 ms | 408 KB | Output is correct |
4 | Correct | 2 ms | 420 KB | Output is correct |
5 | Correct | 2 ms | 420 KB | Output is correct |
6 | Correct | 2 ms | 480 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 480 KB | Output is correct |
2 | Correct | 3 ms | 656 KB | Output is correct |
3 | Correct | 2 ms | 712 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 712 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 712 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 716 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 720 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 768 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 158 ms | 1028 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 30 ms | 1028 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 112 ms | 1108 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |