# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
154204 | 2019-09-19T00:42:18 Z | arnold518 | Calvinball championship (CEOI15_teams) | C++14 | 263 ms | 764 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 = 1e4; const ll MOD = 1e6+7; int N, A[MAXN+10], B[MAXN+10]; ll dp[3][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&1][j]=dp[i-1&1][j]*j+dp[i-1&1][j+1]; dp[i&1][j]%=MOD; } for(j=1; j<A[N-i]; j++) ans+=dp[i&1][max(j, B[N-i-1])]; ans%=MOD; } printf("%lld", ans+1); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 253 ms | 624 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 55 ms | 380 KB | Output is correct |
2 | Correct | 56 ms | 504 KB | Output is correct |
3 | Correct | 67 ms | 508 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 214 ms | 648 KB | Output is correct |
2 | Correct | 213 ms | 628 KB | Output is correct |
3 | Correct | 263 ms | 764 KB | Output is correct |