답안 #159562

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
159562 2019-10-23T08:56:37 Z geon040702 리조트 (KOI16_resort) C++14
100 / 100
2 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

int main(void)
{
    int payment[110][110] = {0}, close[110] = {0};
    int n, m, res, i, j, k;
    res = 999999;

    scanf("%d %d", &n, &m);

    if(m != 0)
    {
        for(i=1;i<=m;i++)
        {
            scanf("%d", &k);
            close[k] = 1;
        }
    }

    for(i=0;i<=n;i++)
    {
        for(j=0;j<=n;j++)
            payment[i][j] = 9999999;
    }
    payment[0][0] = 0;
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            if(payment[i][j] == 9999999) {
                continue;
            }

            if(close[i+1] == 1) {
                payment[i+1][j] = payment[i][j];
            }
            payment[i+1][j] = min(payment[i+1][j], payment[i][j] + 10000);
            payment[i+3][j+1] = min(payment[i+3][j+1], payment[i][j] + 25000);
            payment[i+5][j+2] = min(payment[i+5][j+2], payment[i][j] + 37000);
            if(j >= 3) {
                payment[i+1][j-3] = min(payment[i+1][j-3], payment[i][j]);
            }
        }
    }

    for(i=0;i<=n;i++)
    {
        res = min(res, payment[n][i]);
    }

    printf("%d", res);
    return 0;
 }

Compilation message

resort.cpp: In function 'int main()':
resort.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
resort.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &k);
             ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 504 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 504 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 444 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 376 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 344 KB Output is correct
37 Correct 2 ms 376 KB Output is correct
38 Correct 2 ms 380 KB Output is correct
39 Correct 2 ms 380 KB Output is correct
40 Correct 2 ms 376 KB Output is correct
41 Correct 2 ms 376 KB Output is correct
42 Correct 2 ms 376 KB Output is correct
43 Correct 2 ms 376 KB Output is correct
44 Correct 2 ms 376 KB Output is correct