답안 #86497

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86497 2018-11-26T11:37:01 Z tjdgus4384 요리 강좌 (KOI17_cook) C++14
0 / 100
12 ms 1032 KB
#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++)
    {
        ans = min(ans, d[i][m]);
    }
    printf("%d", ans - t);
    return 0;
}

Compilation message

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]);
         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 888 KB Output is correct
2 Incorrect 4 ms 1032 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 888 KB Output is correct
2 Incorrect 4 ms 1032 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 888 KB Output is correct
2 Incorrect 4 ms 1032 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 888 KB Output is correct
2 Incorrect 4 ms 1032 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 888 KB Output is correct
2 Incorrect 4 ms 1032 KB Output isn't correct
3 Halted 0 ms 0 KB -