| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 31196 | leejseo | 리조트 (KOI16_resort) | C++98 | 0 ms | 1196 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <algorithm>
using namespace std;
#define MAX_N 100 // O(N^3)에 돌리면 충분
#define max_coupon(day) ((day)*2)
#define MAX_C max_coupon(MAX_N)
#define MAX_INT 0x7fffffff
int n, m;
int D[MAX_N + 1][MAX_C + 1];
bool skip[MAX_N + 1];
int solve(){
  for (int i = 0; i <= n; i++){
    for(int j=0; j<= 2*i; j++){
      D[i][j] = MAX_INT;
    }
  }
  D[0][0] = 0;
  
  for (int i=0; i<n; i++){
    for (int j=0; j<= 2*i; j++){
      if (D[i][j] == MAX_INT) continue;
      if (skip[i+1]){
        D[i+1][j] = min(D[i+1][j], D[i][j]);
        continue;
      }
      D[i+1][j] = min(D[i+1][j], D[i][j]+10000);
      for (int k=1; k <4; k++){
        if(i+k > n) break;
        D[i+k][j+1] = min(D[i+k][j+1], D[i][j]+25000);
      }
      for (int k=1; k <6; k++){
        if (i+k > n) break;
        D[i+k][j+2] = min(D[i+k][j+2], D[i][j]+37000);
      }
      if (j >= 3) D[i+1][j-3] = min(D[i+1][j-3], D[i][j]);
    }
  }
  int cnt = MAX_INT;
  for (int j=0; j <= 2*n; j++){
    if (cnt > D[n][j]) cnt = D[n][j];
  }
  return cnt;
}
int main(){
  scanf("%d%d", &n, &m);
  for(int i=0; i <= n; i++) skip[i] = false;
  if (m==0){
    int c = solve();
    printf("%d", c);
    return 0;
  }
  for(int i=0; i <= m; i++){
    int ind;
    scanf("%d", &ind);
    skip[ind] = true;
  }
  int c = solve();
  printf("%d", c);
  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... | ||||
