Submission #100313

# Submission time Handle Problem Language Result Execution time Memory
100313 2019-03-10T11:17:34 Z tpoppo Sličice (COCI19_slicice) C++14
0 / 90
5 ms 384 KB
#include <bits/stdc++.h>

using namespace std;


const int MAXN = 505;

int n,m,k;

int b[MAXN];
int v[MAXN];




int dp[MAXN][MAXN];


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    freopen("in.txt","r",stdin);



    cin >> n >> m >> k;
    for(int i=0;i<n;i++) cin >> v[i];

    for(int i=0;i<=m;i++) cin >> b[i];

    for(int i=0;i<n;i++){
        for(int t=0;t<=k;t++){
            //cout<<dp[i][t]<<" ";
            for(int j=0;j + v[i] <= m && j <= t;j++){

                dp[i+1][t-j] = max(dp[i+1][t - j], dp[i][t] + b[v[i] + j] );
            }

        }//cout<<endl;
    }

    int rs = 0;
    for(int i=0;i<=m;i++) rs = max(rs,dp[n][i]);
    // cout<<i<<": "<<dp[n][i]<<'\n';


    cout<<rs<<'\n';



    return 0;
}

Compilation message

slicice.cpp: In function 'int main()':
slicice.cpp:23:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("in.txt","r",stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Incorrect 4 ms 384 KB Output isn't correct
3 Incorrect 4 ms 384 KB Output isn't correct
4 Incorrect 4 ms 384 KB Output isn't correct
5 Incorrect 4 ms 384 KB Output isn't correct
6 Incorrect 4 ms 384 KB Output isn't correct
7 Incorrect 3 ms 384 KB Output isn't correct
8 Incorrect 3 ms 384 KB Output isn't correct
9 Incorrect 4 ms 384 KB Output isn't correct
10 Incorrect 5 ms 384 KB Output isn't correct