# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1169121 | mkolko21 | Jelly Flavours (IOI20_jelly) | C++20 | 0 ms | 0 KiB |
#include <iostream>
#include <vector>
using namespace std;
int dp[2'007][10'007];
int find_maximum_unique(int x, int y, vector<int> fir, vector<int> sec)
{
int n=fir.size();
for(int a=0; a<n; a++){
for(int i=0; i<=x; i++){
dp[a+1][i]=max(dp[a+1][i],dp[a][i]);
if(sec[a]==0)
dp[a+1][i]=max(dp[a+1][i],dp[a][i]+1):
if(i+fir[a]<=x)
dp[a+1][i+fir[a]]=max(dp[a][i]+1,dp[a+1][i+fir[a]]);
}
}
int odp=dp[n][x];
if(y!=0){
if(sec[0]==0)
odp=n;
else
odp+=y/sec[0];
}
return min(odp,n);
}