Submission #366848

# Submission time Handle Problem Language Result Execution time Memory
366848 2021-02-15T11:51:38 Z leinad2 None (KOI17_cook) C++17
13 / 100
1000 ms 4076 KB
#include<bits/stdc++.h>
#define INF 2110000000
using namespace std;
int dp[3010][3010], i, j, k, l, n, m, s, e, t, A[3010][3010], B[3010], ans=2147483647;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    for(cin>>n>>m>>s>>e>>t;i++<n;)
    {
        for(j=0;j++<m;)
        {
            cin>>A[i][j];
            A[i][j]+=A[i][j-1];
        }
    }
    for(i=0;i++<n;)cin>>B[i];
    for(j=0;j++<m;)
    {
        for(i=0;i++<n;)
        {
            dp[i][j]=INF;
            for(k=j-s;k>=j-e;k--)
            {
                if(k<0)continue;
                for(l=0;l++<n;)
                {
                    if(l==i||l==B[i])continue;
                    dp[i][j]=min(dp[i][j], dp[l][k]+t+A[i][j]-A[i][k]);
                }
            }
        }
    }
    for(i=0;i++<n;)
    {
        for(j=m-1;j>=m-e;j--)
        {
            for(k=0;k++<n;)
            {
                if(k==i||k==B[i])continue;
                ans=min(ans, dp[k][j]+A[i][m]-A[i][j]);
            }
        }
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 748 KB Output is correct
2 Correct 2 ms 748 KB Output is correct
3 Correct 3 ms 748 KB Output is correct
4 Correct 1 ms 620 KB Output is correct
5 Correct 2 ms 748 KB Output is correct
6 Correct 3 ms 768 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 748 KB Output is correct
9 Correct 1 ms 748 KB Output is correct
10 Correct 1 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 748 KB Output is correct
2 Correct 2 ms 748 KB Output is correct
3 Correct 3 ms 748 KB Output is correct
4 Correct 1 ms 620 KB Output is correct
5 Correct 2 ms 748 KB Output is correct
6 Correct 3 ms 768 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 748 KB Output is correct
9 Correct 1 ms 748 KB Output is correct
10 Correct 1 ms 620 KB Output is correct
11 Execution timed out 1090 ms 4076 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 748 KB Output is correct
2 Correct 2 ms 748 KB Output is correct
3 Correct 3 ms 748 KB Output is correct
4 Correct 1 ms 620 KB Output is correct
5 Correct 2 ms 748 KB Output is correct
6 Correct 3 ms 768 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 748 KB Output is correct
9 Correct 1 ms 748 KB Output is correct
10 Execution timed out 1090 ms 4076 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 748 KB Output is correct
2 Correct 2 ms 748 KB Output is correct
3 Correct 3 ms 748 KB Output is correct
4 Correct 1 ms 620 KB Output is correct
5 Correct 2 ms 748 KB Output is correct
6 Correct 3 ms 768 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 748 KB Output is correct
9 Correct 1 ms 748 KB Output is correct
10 Execution timed out 1090 ms 4076 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 748 KB Output is correct
2 Correct 2 ms 748 KB Output is correct
3 Correct 3 ms 748 KB Output is correct
4 Correct 1 ms 620 KB Output is correct
5 Correct 2 ms 748 KB Output is correct
6 Correct 3 ms 768 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 748 KB Output is correct
9 Correct 1 ms 748 KB Output is correct
10 Execution timed out 1090 ms 4076 KB Time limit exceeded
11 Halted 0 ms 0 KB -