# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
54985 | 2018-07-05T16:39:40 Z | kdh9949 | Calvinball championship (CEOI15_teams) | C++17 | 128 ms | 760 KB |
#include <bits/stdc++.h> using namespace std; const int N = 10001, M = 1000007; int n, r, a[N], m[N], d[2][N]; int main(){ scanf("%d", &n); for(int i = 1; i <= n; i++){ scanf("%d", a + i); m[i] = max(m[i - 1], a[i]); } fill(d[0], d[0] + N, 1); r = a[n]; for(int i = n - 1, p = 1; i >= 1; i--, p ^= 1){ for(int j = 1; j <= m[i - 1] + 1; j++) d[p][j] = (d[!p][j + 1] + 1LL * j * d[!p][j]) % M; r = (r + (a[i] - 1LL) * d[p][m[i - 1]]) % M; } printf("%d\n", r % M); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 3 ms | 380 KB | Output is correct |
3 | Correct | 3 ms | 564 KB | Output is correct |
4 | Correct | 3 ms | 564 KB | Output is correct |
5 | Correct | 2 ms | 564 KB | Output is correct |
6 | Correct | 3 ms | 572 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 572 KB | Output is correct |
2 | Correct | 2 ms | 572 KB | Output is correct |
3 | Correct | 2 ms | 620 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 620 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 620 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 620 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 620 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 620 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 128 ms | 760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 760 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 760 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |