Submission #986144

#TimeUsernameProblemLanguageResultExecution timeMemory
986144SofiatpcJelly Flavours (IOI20_jelly)C++14
0 / 100
2060 ms133876 KiB
#include "jelly.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 2005, MAX = 1e4+5; int dp[MAXN][MAX], dp2[MAXN][MAX]; int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) { int n = a.size(); sort(a.begin(),a.end()); int ans = 0; for(int i = 0; i <= n; i++){ for(int k = 0; k <= x; k++)dp[i+1][k] = 0; for(int j = i; j >= 1; j--) for(int k = 0; k <= x; k++){ if(k < a[j-1])dp[j][k] = dp[j+1][k]+b[j-1]; else dp[j][k] = min(dp[j+1][k]+b[j-1], dp[j+1][k-a[j-1]]); } if(y < dp[1][x])continue; int r = y - dp[1][x]; for(int j = n; j >= i+1; j--) for(int k = 0; k <= r; k++){ if(k < b[j-1])dp2[j][k] = dp2[j+1][k]; else dp2[j][k] = max(dp2[j+1][k], dp2[j+1][k-b[j-1]]+1); } ans = max(i+dp2[i+1][r], ans); } return ans; }
#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...