Submission #949590

#TimeUsernameProblemLanguageResultExecution timeMemory
949590tnunJelly Flavours (IOI20_jelly)C++14
0 / 100
57 ms78420 KiB
#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][j-c[i].first]); } uld=min(uld,dp[i][j]); } uld=y-uld; 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++; } } ans=max(cnt,ans); } return ans; }

Compilation message (stderr)

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:31:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   for(int k=0;k<temp.size();k++){
      |               ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...