Submission #1172133

#TimeUsernameProblemLanguageResultExecution timeMemory
1172133M_W_13Jelly Flavours (IOI20_jelly)C++20
19 / 100
35 ms528 KiB
#include "jelly.h" #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; #define pb push_back #define st first #define nd second const int MAXA = 1e4 + 7; struct pam { int wyn; int suma; }; pam dp[MAXA]; int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) { int n = a.size(); rep(i, MAXA) { dp[i] = {0, 0}; } rep(i, n) { for (int j = MAXA - 1; j >= 0; j--) { if (j < a[i]) { if (dp[j].suma + b[i] <= y) { dp[j] = {dp[j].wyn + 1, dp[j].suma + b[i]}; } } else { if (dp[j].suma + b[i] <= y) { dp[j] = {dp[j].wyn + 1, dp[j].suma + b[i]}; } if (dp[j - a[i]].wyn + 1 > dp[j].wyn) { dp[j].wyn = dp[j - a[i]].wyn + 1; } else if (dp[j - a[i]].wyn + 1 == dp[j].wyn) { dp[j].suma = min(dp[j].suma, dp[j - a[i]].suma); } } } } return dp[x].wyn; }
#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...