제출 #159562

#제출 시각아이디문제언어결과실행 시간메모리
159562geon040702리조트 (KOI16_resort)C++14
100 / 100
2 ms504 KiB
#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;
 }

컴파일 시 표준 에러 (stderr) 메시지

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);
             ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...