# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44859 | 2018-04-08T09:49:16 Z | bogdan10bos | Calvinball championship (CEOI15_teams) | C++14 | 467 ms | 964 KB |
#include <bits/stdc++.h> using namespace std; //#define FILE_IO const int mod = 1e6 + 7; int N; int v[10005]; int mxx[10005]; int dp[10005]; int main() { #ifdef FILE_IO freopen("1.in", "r", stdin); freopen("1.out", "w", stdout); #endif scanf("%d", &N); for(int i = 1; i <= N; i++) { scanf("%d", &v[i]); mxx[i] = max(mxx[i - 1], v[i]); } for(int i = 1; i <= N; i++) dp[i] = 1; int ans = 1; for(int i = N; i >= 1; i--) { (ans += (1LL * (v[i] - 1) * dp[ mxx[i - 1] ]) % mod) %= mod; for(int j = 1; j <= N; j++) dp[j] = ((1LL * dp[j] * j) % mod + dp[j + 1]) % mod; } printf("%d\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 | 376 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 540 KB | Output is correct |
5 | Correct | 2 ms | 540 KB | Output is correct |
6 | Correct | 2 ms | 544 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 560 KB | Output is correct |
2 | Correct | 2 ms | 560 KB | Output is correct |
3 | Correct | 2 ms | 560 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 560 KB | Output is correct |
2 | Correct | 2 ms | 608 KB | Output is correct |
3 | Correct | 2 ms | 608 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 608 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 608 KB | Output is correct |
2 | Correct | 2 ms | 608 KB | Output is correct |
3 | Correct | 2 ms | 608 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 620 KB | Output is correct |
2 | Correct | 3 ms | 620 KB | Output is correct |
3 | Correct | 3 ms | 636 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 636 KB | Output is correct |
2 | Correct | 7 ms | 636 KB | Output is correct |
3 | Correct | 6 ms | 636 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 414 ms | 740 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 110 ms | 740 KB | Output is correct |
2 | Correct | 105 ms | 740 KB | Output is correct |
3 | Correct | 112 ms | 740 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 416 ms | 804 KB | Output is correct |
2 | Correct | 415 ms | 804 KB | Output is correct |
3 | Correct | 467 ms | 964 KB | Output is correct |