# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
422740 | 2021-06-10T11:29:27 Z | KienTranluvChaeng | Calvinball championship (CEOI15_teams) | C++17 | 527 ms | 584 KB |
#include <bits/stdc++.h> #define mod 1000007 using namespace std; const int O = 1e4 + 1; int n, f[2][O], a[O], Max[O]; main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; ++ i) cin >> a[i], Max[i] = max(Max[i - 1], a[i]); int bit = 0; for (int i = 0; i <= n; ++ i) f[bit][i] = 1; int ans = 1; for (int i = n; i >= 1; -- i){ bit ^= 1; for (int j = 1; j <= n; ++ j){ f[bit][j] = f[bit ^ 1][j + 1] + 1ll * f[bit ^ 1][j] * j % mod; f[bit][j] %= mod; if (j < a[i]) ans = (ans + f[bit ^ 1][max(Max[i - 1], j)]) % mod; } } cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 240 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 2 ms | 332 KB | Output is correct |
3 | Correct | 2 ms | 316 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 332 KB | Output is correct |
2 | Correct | 5 ms | 332 KB | Output is correct |
3 | Correct | 6 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 526 ms | 496 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 101 ms | 404 KB | Output is correct |
2 | Correct | 104 ms | 404 KB | Output is correct |
3 | Correct | 133 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 409 ms | 480 KB | Output is correct |
2 | Correct | 458 ms | 476 KB | Output is correct |
3 | Correct | 527 ms | 584 KB | Output is correct |