# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
59045 | 2018-07-20T10:06:04 Z | sansae | 리조트 (KOI16_resort) | C++14 | 4 ms | 1152 KB |
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> #include <iostream> using namespace std; int main() { int n, m; scanf("%d %d", &n, &m); int goo[n]; for(int i=0;i<n;i++){ goo[i]=1; } int a[m]; for(int i=0;i<m;i++){ scanf("%d", &a[i]); goo[a[i]-1]=0; } int dp[n+6][4*n]; for(int i=0;i<n+6;i++){ for(int j=0;j<4*n;j++){ dp[i][j]=0; } } for(int i=n;i<=n+5;i++){ for(int j=0;j<4*n;j++){ dp[i][j]=0; } } for(int j=3*n;j<4*n;j++){ for(int i=0;i<n;i++){ dp[i][j]=0; } } for(int i=n-1;i>=0;i--){ for(int j=3*n-1;j>=0;j--){ if(goo[i]==0){ dp[i][j]=dp[i+1][j]; } else{ int aa=dp[i+1][j]+10000; int bb=dp[i+3][j+1]+25000; int cc=dp[i+5][j+2]+37000; int dd; if(j>=3){ dd=dp[i+1][j-3]; } int min=aa; if(min>bb){ min=bb; } if(min>cc){ min=cc; } if(j>=3){ if(min>dd){ min=dd; } } dp[i][j]=min; } } } printf("%d", dp[0][0]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 3 ms | 496 KB | Output is correct |
4 | Correct | 2 ms | 496 KB | Output is correct |
5 | Correct | 2 ms | 496 KB | Output is correct |
6 | Correct | 3 ms | 496 KB | Output is correct |
7 | Correct | 3 ms | 596 KB | Output is correct |
8 | Correct | 2 ms | 596 KB | Output is correct |
9 | Correct | 2 ms | 596 KB | Output is correct |
10 | Correct | 3 ms | 724 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 724 KB | Output is correct |
2 | Correct | 2 ms | 728 KB | Output is correct |
3 | Correct | 2 ms | 744 KB | Output is correct |
4 | Correct | 3 ms | 744 KB | Output is correct |
5 | Correct | 2 ms | 772 KB | Output is correct |
6 | Correct | 2 ms | 772 KB | Output is correct |
7 | Correct | 2 ms | 796 KB | Output is correct |
8 | Correct | 2 ms | 800 KB | Output is correct |
9 | Correct | 2 ms | 804 KB | Output is correct |
10 | Correct | 4 ms | 808 KB | Output is correct |
11 | Correct | 3 ms | 940 KB | Output is correct |
12 | Correct | 3 ms | 944 KB | Output is correct |
13 | Correct | 3 ms | 944 KB | Output is correct |
14 | Correct | 4 ms | 944 KB | Output is correct |
15 | Correct | 2 ms | 944 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 3 ms | 496 KB | Output is correct |
4 | Correct | 2 ms | 496 KB | Output is correct |
5 | Correct | 2 ms | 496 KB | Output is correct |
6 | Correct | 3 ms | 496 KB | Output is correct |
7 | Correct | 3 ms | 596 KB | Output is correct |
8 | Correct | 2 ms | 596 KB | Output is correct |
9 | Correct | 2 ms | 596 KB | Output is correct |
10 | Correct | 3 ms | 724 KB | Output is correct |
11 | Correct | 2 ms | 724 KB | Output is correct |
12 | Correct | 2 ms | 728 KB | Output is correct |
13 | Correct | 2 ms | 744 KB | Output is correct |
14 | Correct | 3 ms | 744 KB | Output is correct |
15 | Correct | 2 ms | 772 KB | Output is correct |
16 | Correct | 2 ms | 772 KB | Output is correct |
17 | Correct | 2 ms | 796 KB | Output is correct |
18 | Correct | 2 ms | 800 KB | Output is correct |
19 | Correct | 2 ms | 804 KB | Output is correct |
20 | Correct | 4 ms | 808 KB | Output is correct |
21 | Correct | 3 ms | 940 KB | Output is correct |
22 | Correct | 3 ms | 944 KB | Output is correct |
23 | Correct | 3 ms | 944 KB | Output is correct |
24 | Correct | 4 ms | 944 KB | Output is correct |
25 | Correct | 2 ms | 944 KB | Output is correct |
26 | Correct | 2 ms | 944 KB | Output is correct |
27 | Correct | 3 ms | 964 KB | Output is correct |
28 | Correct | 3 ms | 964 KB | Output is correct |
29 | Correct | 3 ms | 964 KB | Output is correct |
30 | Correct | 3 ms | 968 KB | Output is correct |
31 | Correct | 3 ms | 972 KB | Output is correct |
32 | Correct | 2 ms | 976 KB | Output is correct |
33 | Correct | 3 ms | 976 KB | Output is correct |
34 | Correct | 2 ms | 1036 KB | Output is correct |
35 | Correct | 2 ms | 1036 KB | Output is correct |
36 | Correct | 3 ms | 1036 KB | Output is correct |
37 | Correct | 2 ms | 1036 KB | Output is correct |
38 | Correct | 3 ms | 1036 KB | Output is correct |
39 | Correct | 3 ms | 1132 KB | Output is correct |
40 | Correct | 4 ms | 1136 KB | Output is correct |
41 | Correct | 4 ms | 1140 KB | Output is correct |
42 | Correct | 3 ms | 1144 KB | Output is correct |
43 | Correct | 3 ms | 1148 KB | Output is correct |
44 | Correct | 3 ms | 1152 KB | Output is correct |