# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
86565 | 2018-11-26T15:11:25 Z | tjdgus4384 | 리조트 (KOI16_resort) | C++14 | 3 ms | 892 KB |
#include<cstdio> #include<string.h> #include<vector> #include<algorithm> using namespace std; int cant[101]; int d[101][101], n; int dfs(int x, int c) { if(x >= n + 1) return 0; if(d[x][c] != -1) return d[x][c]; d[x][c] = 2e9; if(cant[x]) d[x][c] = dfs(x + 1, c); else if(c >= 3) d[x][c] = dfs(x + 1, c - 3); else d[x][c] = dfs(x + 1, c) + 10000; d[x][c] = min(d[x][c], dfs(x + 3, c + 1) + 25000); d[x][c] = min(d[x][c], dfs(x + 5, c + 2) + 37000); return d[x][c]; } int main() { int m, x; scanf("%d %d", &n, &m); for(int i = 0;i < m;i++) { scanf("%d", &x); cant[x] = 1; } memset(d, -1, sizeof(d)); printf("%d", dfs(1, 0)); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 2 ms | 548 KB | Output is correct |
5 | Correct | 2 ms | 632 KB | Output is correct |
6 | Correct | 2 ms | 632 KB | Output is correct |
7 | Correct | 2 ms | 652 KB | Output is correct |
8 | Correct | 2 ms | 672 KB | Output is correct |
9 | Correct | 2 ms | 672 KB | Output is correct |
10 | Correct | 2 ms | 672 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 672 KB | Output is correct |
2 | Correct | 2 ms | 672 KB | Output is correct |
3 | Correct | 2 ms | 672 KB | Output is correct |
4 | Correct | 2 ms | 672 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 | 772 KB | Output is correct |
8 | Correct | 2 ms | 772 KB | Output is correct |
9 | Correct | 2 ms | 772 KB | Output is correct |
10 | Correct | 2 ms | 772 KB | Output is correct |
11 | Correct | 2 ms | 772 KB | Output is correct |
12 | Correct | 2 ms | 772 KB | Output is correct |
13 | Correct | 2 ms | 772 KB | Output is correct |
14 | Correct | 2 ms | 772 KB | Output is correct |
15 | Correct | 2 ms | 772 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 2 ms | 548 KB | Output is correct |
5 | Correct | 2 ms | 632 KB | Output is correct |
6 | Correct | 2 ms | 632 KB | Output is correct |
7 | Correct | 2 ms | 652 KB | Output is correct |
8 | Correct | 2 ms | 672 KB | Output is correct |
9 | Correct | 2 ms | 672 KB | Output is correct |
10 | Correct | 2 ms | 672 KB | Output is correct |
11 | Correct | 2 ms | 672 KB | Output is correct |
12 | Correct | 2 ms | 672 KB | Output is correct |
13 | Correct | 2 ms | 672 KB | Output is correct |
14 | Correct | 2 ms | 672 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 | 772 KB | Output is correct |
18 | Correct | 2 ms | 772 KB | Output is correct |
19 | Correct | 2 ms | 772 KB | Output is correct |
20 | Correct | 2 ms | 772 KB | Output is correct |
21 | Correct | 2 ms | 772 KB | Output is correct |
22 | Correct | 2 ms | 772 KB | Output is correct |
23 | Correct | 2 ms | 772 KB | Output is correct |
24 | Correct | 2 ms | 772 KB | Output is correct |
25 | Correct | 2 ms | 772 KB | Output is correct |
26 | Correct | 2 ms | 772 KB | Output is correct |
27 | Correct | 2 ms | 772 KB | Output is correct |
28 | Correct | 3 ms | 772 KB | Output is correct |
29 | Correct | 2 ms | 772 KB | Output is correct |
30 | Correct | 2 ms | 772 KB | Output is correct |
31 | Correct | 2 ms | 772 KB | Output is correct |
32 | Correct | 2 ms | 772 KB | Output is correct |
33 | Correct | 2 ms | 772 KB | Output is correct |
34 | Correct | 2 ms | 772 KB | Output is correct |
35 | Correct | 2 ms | 772 KB | Output is correct |
36 | Correct | 2 ms | 772 KB | Output is correct |
37 | Correct | 2 ms | 772 KB | Output is correct |
38 | Correct | 2 ms | 772 KB | Output is correct |
39 | Correct | 2 ms | 772 KB | Output is correct |
40 | Correct | 2 ms | 772 KB | Output is correct |
41 | Correct | 2 ms | 772 KB | Output is correct |
42 | Correct | 2 ms | 772 KB | Output is correct |
43 | Correct | 2 ms | 780 KB | Output is correct |
44 | Correct | 2 ms | 892 KB | Output is correct |