| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 93735 | abood101 | Calvinball championship (CEOI15_teams) | C++17 | 1077 ms | 552 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int > pp;
typedef long long ll;
int const N=1e4+2,oo=1e9,M=1e6;
ll const OO=1e18;
double const eps=1e-6,PI=acos(-1);
int mod=M+7;
int n,aa[N],dp[2][N][2];
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&aa[i]);
int f=0;
for(int i=1;i<=n;i++)dp[f][i][0]=dp[f][i][1]=1;
for(int i=n-2;i>-1;i--){
f=1-f;
for(int j=1;j<=i+1;j++){
dp[f][j][1]=dp[!f][j][1]*1LL*j%mod;
dp[f][j][1]+=dp[!f][j+1][1];
if(dp[f][j][1]>=mod)dp[f][j][1]-=mod;
if(aa[i+1]>j){
dp[f][j][0]=dp[!f][j][1]*1LL*j%mod;
if(aa[i+1]==j+1)dp[f][j][0]+=dp[!f][aa[i+1]][0];
if(dp[f][j][0]>=mod)dp[f][j][0]-=mod;
}else {
dp[f][j][0]=dp[!f][j][1]*1LL*(aa[i+1]-1)%mod;
dp[f][j][0]+=dp[!f][j][0];
if(dp[f][j][0]>=mod)dp[f][j][0]-=mod;
}
}
}
printf("%d\n",dp[f][1][0]);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
