# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
244444 | 2020-07-04T05:59:26 Z | dwsc | Calvinball championship (CEOI15_teams) | C++14 | 732 ms | 888 KB |
#include <bits/stdc++.h> #define int long long using namespace std; int MOD = 1e6+7; int memo[2][10010][2]; int arr[10010]; int n; main(){ cin >> n; for (int i = 0; i < n; i++){ int x; cin >> x; arr[i] = x; } for (int i = 0; i <= n; i++) memo[n%2][i][0] = memo[n%2][i][1] = 1; for (int i = n-1; i >= 0; i--){ for (int j = 0; j <= i; j++){ int curnum = arr[i]; int ans = ((curnum-1)*memo[1-i%2][j][0]); ans += memo[1-i%2][max(j,curnum)][1]; memo[i%2][j][1] = ans%MOD; int ans2 = (j*memo[1-i%2][j][0]) + memo[1-i%2][j+1][0]; memo[i%2][j][0] = ans2%MOD; } } cout << memo[0][0][1]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 384 KB | Output is correct |
2 | Correct | 11 ms | 384 KB | Output is correct |
3 | Correct | 12 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 714 ms | 864 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 171 ms | 512 KB | Output is correct |
2 | Correct | 166 ms | 568 KB | Output is correct |
3 | Correct | 185 ms | 564 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 662 ms | 768 KB | Output is correct |
2 | Correct | 660 ms | 888 KB | Output is correct |
3 | Correct | 732 ms | 760 KB | Output is correct |