# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
949594 | tnun | Jelly Flavours (IOI20_jelly) | C++14 | 70 ms | 78932 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
pair<int,int> c[2005];
int dp[2005][10005];
int find_maximum_unique(int x, int y,vector<int> a,vector<int> b){
int sz=a.size();
int ans=0;
for(int i=0;i<sz;i++){
c[i+1]=mp(a[i],b[i]);
}
sort(c+1,c+sz+1);
for(int i=1;i<=sz;i++){
int uld=10005;
for(int j=0;j<=x;j++){
dp[i][j]=dp[i-1][j]+c[i].second;
if(j>=c[i].first){
dp[i][j]=min(dp[i][j],dp[i-1][j-c[i].first]);
}
uld=min(uld,dp[i][j]);
}
uld=y-uld;
if(uld<0){
continue;
}
int cnt=i;
vector<int> temp;
for(int k=i+1;k<=sz;k++){
temp.pb(c[k].second);
}
sort(temp.begin(),temp.end());
for(int k=0;k<temp.size();k++){
if(uld>=temp[k]){
uld-=temp[k];
cnt++;
}else{
break;
}
}
ans=max(cnt,ans);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |