| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 47975 | Extazy | Calvinball championship (CEOI15_teams) | C++17 | 137 ms | 1096 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int N = 10007;
const int MOD = (1e6) + 7;
int n,a[N],pos,cnt;
int dp[2][N];
int state_cnt[N],state_coef[N];
long long ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i;
  scanf("%d", &n);
  for(i=1;i<=n;i++) {
    scanf("%d", &a[i]);
  }
  ans=1;
  cnt=1;
  for(pos=2;pos<=n;pos++) {
    if(a[pos]>cnt) {
      state_cnt[pos]=cnt;
      state_coef[pos]=cnt;
      
      ++cnt;
    }
    else {
      state_cnt[pos]=cnt;
      state_coef[pos]=a[pos]-1;
    }
  }
  for(cnt=0;cnt<=n;cnt++) {
    dp[(n+1)&1][cnt]=1;
  }
  for(pos=n;pos>=2;pos--) {
    ans+=dp[(pos+1)&1][state_cnt[pos]]*1ll*state_coef[pos]%MOD;
    for(cnt=1;cnt<pos;cnt++) {
      dp[pos&1][cnt]=(dp[(pos+1)&1][cnt+1]+dp[(pos+1)&1][cnt]*1ll*cnt)%MOD;
    }
  }
  
  ans%=MOD;
  printf("%lld\n", ans);
  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... | ||||
