# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
54777 | 2018-07-05T05:06:08 Z | 김세빈(#1509) | Calvinball championship (CEOI15_teams) | C++11 | 111 ms | 916 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1e6 + 7; ll K[10101], T[10101]; ll D[2][10101]; ll n, ans; int main() { ll i, j; scanf("%lld", &n); for(i=1;i<=n;i++){ scanf("%lld", K+i); T[i] = max(T[i-1], K[i]); } for(i=1;i<=n;i++) D[n&1][i] = 1; ans = K[n] - 1; for(i=n-1;i>=1;i--){ for(j=1;j<=i;j++){ D[i&1][j] = (D[~i&1][j] * j + D[~i&1][j+1]) % mod; } ans = (ans + (K[i] - 1) * D[i&1][T[i]-1]) % mod; } printf("%lld\n", ans + 1); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 2 ms | 468 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 2 ms | 540 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 560 KB | Output is correct |
2 | Correct | 2 ms | 684 KB | Output is correct |
3 | Correct | 2 ms | 684 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 684 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 740 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 740 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 740 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 740 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 111 ms | 916 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 30 ms | 916 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 111 ms | 916 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |