# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
570666 |
2022-05-31T02:47:56 Z |
AGE |
Sličice (COCI19_slicice) |
C++14 |
|
99 ms |
2268 KB |
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define int long long
using namespace std;
int dp[505][505],a[505],b[505];
main()
{
int n,m,kk;
cin>>n>>m>>kk;
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<=m;i++)
cin>>b[i];
for(int i=a[0];i<=m;i++){
if(kk-(i-a[0])<0)
continue;
dp[0][kk-(i-a[0])]=max(dp[0][kk-(i-a[0])],dp[0][i]+b[i]);
}
for(int i=0;i<n-1;i++){
for(int j=0;j<=kk;j++){
for(int k=a[i+1];k<=m;k++){
int x=j-(k-a[i+1]);
if(x<0)
continue;
dp[i+1][x]=max(dp[i+1][x],dp[i][j]+b[k]);
}
}
}
int ans=-1e18;
for(int i=0;i<=kk;i++)
ans=max(ans,dp[n-1][i]);
cout<<ans<<endl;
return 0;
}
Compilation message
slicice.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
8 | main()
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2260 KB |
Output is correct |
2 |
Correct |
2 ms |
2260 KB |
Output is correct |
3 |
Incorrect |
57 ms |
2176 KB |
Output isn't correct |
4 |
Incorrect |
66 ms |
2268 KB |
Output isn't correct |
5 |
Incorrect |
64 ms |
2228 KB |
Output isn't correct |
6 |
Incorrect |
58 ms |
2252 KB |
Output isn't correct |
7 |
Incorrect |
56 ms |
2128 KB |
Output isn't correct |
8 |
Incorrect |
59 ms |
2152 KB |
Output isn't correct |
9 |
Incorrect |
56 ms |
2180 KB |
Output isn't correct |
10 |
Incorrect |
99 ms |
2252 KB |
Output isn't correct |