제출 #86513

#제출 시각아이디문제언어결과실행 시간메모리
86513tjdgus4384요리 강좌 (KOI17_cook)C++14
13 / 100
1059 ms5936 KiB
#include<cstdio>
#include<algorithm>
using namespace std;
int c[3001][3001], sum[3001][3001];
int x[3001], d[3001][3001];

int main()
{
    int n, m, s, e, t;
    scanf("%d %d %d %d %d", &n, &m, &s, &e, &t);
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= m;j++)
        {
            scanf("%d", &c[i][j]);
            sum[i][j] = sum[i][j - 1] + c[i][j];
        }
    }
    for(int i = 1;i <= n;i++)
    {
        scanf("%d", &x[i]);
    }
    for(int j = 1;j <= m;j++)
    {
        for(int i = 1;i <= n;i++)
        {
            d[i][j] = 2e9;
            for(int a = 1;a <= n;a++)
            {
                if(a == i || a == x[i]) continue;
                for(int b = j - e;b <= j - s;b++)
                {
                    if(b < 0) continue;
                    d[i][j] = min(d[i][j], d[a][b] + sum[i][j] - sum[i][b] + t);
                }
            }
        }
    }
    int ans = 2e9;
    for(int i = 1;i <= n;i++)
    {
        for(int a = 1;a <= n;a++)
        {
            if(a == i || a == x[i]) continue;
            for(int b = m - e;b <= m;b++)
            {
                if(b < 0) continue;
                ans = min(ans, d[a][b] + sum[i][m] - sum[i][b] + t);
            }
        }
    }
    printf("%d", ans - t);
    return 0;
}

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

cook.cpp: In function 'int main()':
cook.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d %d %d", &n, &m, &s, &e, &t);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cook.cpp:15:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &c[i][j]);
             ~~~~~^~~~~~~~~~~~~~~~
cook.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &x[i]);
         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...