# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154203 | 2019-09-19T00:41:09 Z | arnold518 | Calvinball championship (CEOI15_teams) | C++14 | 22 ms | 16632 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 1e3; const ll MOD = 1e6+7; int N, A[MAXN+10], B[MAXN+10]; ll dp[MAXN+10][MAXN+10], ans; int main() { int i, j; scanf("%d", &N); for(i=1; i<=N; i++) scanf("%d", &A[i]); for(i=1; i<=N; i++) B[i]=max(B[i-1], A[i]); for(j=1; j<=N; j++) dp[0][j]=1; ans+=A[N]-1; for(i=1; i<=N; i++) { for(j=1; j<=N; j++) { dp[i][j]=dp[i-1][j]*j+dp[i-1][j+1]; dp[i][j]%=MOD; } for(j=1; j<A[N-i]; j++) ans+=dp[i][max(j, B[N-i-1])]; ans%=MOD; } printf("%lld", ans+1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
# | 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 | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 476 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 760 KB | Output is correct |
2 | Correct | 3 ms | 760 KB | Output is correct |
3 | Correct | 2 ms | 760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4344 KB | Output is correct |
2 | Correct | 6 ms | 4344 KB | Output is correct |
3 | Correct | 6 ms | 4256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 8184 KB | Output is correct |
2 | Correct | 10 ms | 8312 KB | Output is correct |
3 | Correct | 11 ms | 8184 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 22 ms | 16632 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |