# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
244494 | 2020-07-04T07:29:33 Z | shenxy | Calvinball championship (CEOI15_teams) | C++11 | 440 ms | 632 KB |
//happy birthday errorgorn #include <cstdio> #include <algorithm> using namespace std; const long long mod = 1000007; int main() { int n; scanf("%d", &n); int a[n], sa[n]; long long ans = 1; for (int i = 0; i < n; ++i) scanf("%d", &a[i]); sa[0] = a[0]; for (int i = 1; i < n; ++i) sa[i] = max(sa[i - 1], a[i]); long long dptable[2][n + 1]; fill_n(dptable[0], n + 1, 1); for (int i = 1; i <= n; ++i) { for (int j = 1; j < a[n - i]; ++j) ans = (ans + dptable[1 - (i & 1)][max(j, i == n ? 0 : sa[n - i - 1])]) % mod; for (int j = 0; j < n; ++j) dptable[i & 1][j] = (j * dptable[1 - (i & 1)][j] + dptable[1 - (i & 1)][j + 1]) % mod; dptable[i & 1][n] = n * dptable[1 - (i & 1)][n] % mod; } printf("%lld", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 308 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 6 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 384 KB | Output is correct |
2 | Correct | 7 ms | 256 KB | Output is correct |
3 | Correct | 9 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 427 ms | 568 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 57 ms | 504 KB | Output is correct |
2 | Correct | 57 ms | 460 KB | Output is correct |
3 | Correct | 111 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 210 ms | 632 KB | Output is correct |
2 | Correct | 213 ms | 512 KB | Output is correct |
3 | Correct | 440 ms | 512 KB | Output is correct |