# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
46863 | 2018-04-24T06:34:30 Z | HachikujiMayoi | Calvinball championship (CEOI15_teams) | C++14 | 131 ms | 1256 KB |
#include <bits/stdc++.h> using namespace std; const int N = 10007; const long long mod = 1000007; long long dp[N][2]; int C[N]; int main(){ int n; scanf("%d", &n); for(int i = 1; i <= n; ++i){ scanf("%d", &C[i]); } int M = 0; for(int i = 1; i <= n; ++i){ int B = i & 1; for(int j = 1; j <= i; ++j){ dp[j][B] = (dp[j][B ^ 1] * j + dp[j - 1][B ^ 1]) % mod; } dp[M][B] = (dp[M][B] + C[i] - 1) % mod; M = max(M, C[i]); } long long ans = 1; for(int i = 1; i <= n; ++i){ ans += dp[i][n & 1]; ans %= mod; } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 472 KB | Output is correct |
3 | Correct | 2 ms | 496 KB | Output is correct |
4 | Correct | 2 ms | 496 KB | Output is correct |
5 | Correct | 2 ms | 496 KB | Output is correct |
6 | Correct | 2 ms | 616 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 644 KB | Output is correct |
2 | Correct | 2 ms | 656 KB | Output is correct |
3 | Correct | 2 ms | 664 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 712 KB | Output is correct |
2 | Correct | 2 ms | 756 KB | Output is correct |
3 | Correct | 2 ms | 756 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 756 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 768 KB | Output is correct |
2 | Correct | 2 ms | 768 KB | Output is correct |
3 | Correct | 2 ms | 768 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 796 KB | Output is correct |
2 | Correct | 2 ms | 800 KB | Output is correct |
3 | Correct | 2 ms | 804 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 808 KB | Output is correct |
2 | Correct | 4 ms | 808 KB | Output is correct |
3 | Correct | 3 ms | 816 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 125 ms | 1256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 1256 KB | Output is correct |
2 | Correct | 30 ms | 1256 KB | Output is correct |
3 | Correct | 31 ms | 1256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 131 ms | 1256 KB | Output is correct |
2 | Correct | 115 ms | 1256 KB | Output is correct |
3 | Correct | 113 ms | 1256 KB | Output is correct |