# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
244573 | 2020-07-04T09:58:31 Z | dantoh000 | Calvinball championship (CEOI15_teams) | C++14 | 219 ms | 564 KB |
///happy birthday errorgorn #include <bits/stdc++.h> using namespace std; const int mod = 1000007; typedef long long ll; int n; int a[10005]; ll dp[2][10005]; int mx[10005]; ll ans = 0; int main(){ scanf("%d",&n); for (int i = 1; i <= n; i++){ scanf("%d",&a[i]); mx[i] = max(mx[i-1],a[i]); } for (int i = 1; i <= n; i++){ dp[0][i] = 1; } for (int i = 1; i < n; i++){ for (int j = 1; j <= n; j++){ dp[i&1][j] = j*dp[1-i&1][j] + dp[1-i&1][j+1]; dp[i&1][j] %= mod; } ans += (a[n-i]-1)*dp[i&1][mx[n-i-1]]; ans %= mod; } ans = (ans+a[n])%mod; printf("%lld",ans); }
Compilation message
# | 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 |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 256 KB | Output is correct |
6 | 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 | 4 ms | 384 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 | 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 | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 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 | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 384 KB | Output is correct |
2 | Correct | 8 ms | 384 KB | Output is correct |
3 | Correct | 10 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 205 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 384 KB | Output is correct |
2 | Correct | 64 ms | 384 KB | Output is correct |
3 | Correct | 54 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 206 ms | 512 KB | Output is correct |
2 | Correct | 210 ms | 512 KB | Output is correct |
3 | Correct | 219 ms | 564 KB | Output is correct |