Submission #86513

# Submission time Handle Problem Language Result Execution time Memory
86513 2018-11-26T11:50:17 Z tjdgus4384 None (KOI17_cook) C++14
13 / 100
1000 ms 5936 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++)
    {
        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;
}

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]);
         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 888 KB Output is correct
2 Correct 4 ms 1156 KB Output is correct
3 Correct 8 ms 1156 KB Output is correct
4 Correct 3 ms 1156 KB Output is correct
5 Correct 4 ms 1156 KB Output is correct
6 Correct 5 ms 1200 KB Output is correct
7 Correct 5 ms 1228 KB Output is correct
8 Correct 4 ms 1332 KB Output is correct
9 Correct 3 ms 1380 KB Output is correct
10 Correct 3 ms 1380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 888 KB Output is correct
2 Correct 4 ms 1156 KB Output is correct
3 Correct 8 ms 1156 KB Output is correct
4 Correct 3 ms 1156 KB Output is correct
5 Correct 4 ms 1156 KB Output is correct
6 Correct 5 ms 1200 KB Output is correct
7 Correct 5 ms 1228 KB Output is correct
8 Correct 4 ms 1332 KB Output is correct
9 Correct 3 ms 1380 KB Output is correct
10 Execution timed out 1059 ms 5936 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 888 KB Output is correct
2 Correct 4 ms 1156 KB Output is correct
3 Correct 8 ms 1156 KB Output is correct
4 Correct 3 ms 1156 KB Output is correct
5 Correct 4 ms 1156 KB Output is correct
6 Correct 5 ms 1200 KB Output is correct
7 Correct 5 ms 1228 KB Output is correct
8 Correct 4 ms 1332 KB Output is correct
9 Correct 3 ms 1380 KB Output is correct
10 Execution timed out 1059 ms 5936 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 888 KB Output is correct
2 Correct 4 ms 1156 KB Output is correct
3 Correct 8 ms 1156 KB Output is correct
4 Correct 3 ms 1156 KB Output is correct
5 Correct 4 ms 1156 KB Output is correct
6 Correct 5 ms 1200 KB Output is correct
7 Correct 5 ms 1228 KB Output is correct
8 Correct 4 ms 1332 KB Output is correct
9 Correct 3 ms 1380 KB Output is correct
10 Execution timed out 1059 ms 5936 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 888 KB Output is correct
2 Correct 4 ms 1156 KB Output is correct
3 Correct 8 ms 1156 KB Output is correct
4 Correct 3 ms 1156 KB Output is correct
5 Correct 4 ms 1156 KB Output is correct
6 Correct 5 ms 1200 KB Output is correct
7 Correct 5 ms 1228 KB Output is correct
8 Correct 4 ms 1332 KB Output is correct
9 Correct 3 ms 1380 KB Output is correct
10 Execution timed out 1059 ms 5936 KB Time limit exceeded
11 Halted 0 ms 0 KB -