Submission #561564

#TimeUsernameProblemLanguageResultExecution timeMemory
561564PiejanVDCJelly Flavours (IOI20_jelly)C++17
35 / 100
1002 ms203824 KiB
#include <bits/stdc++.h> #include "jelly.h" using namespace std; #define f first #define s second vector<pair<int,int>>v; int N; int dp[200][501][501]; bool ok[200][501][501]; int dfs(int i, int x, int y) { if(i == N) return 0; if(ok[i][x][y]) return dp[i][x][y]; int ret = 0; if(x >= v[i].f) ret = max(ret, 1 + dfs(i+1, x - v[i].f, y)); if(y >= v[i].s) ret = max(ret, 1 + dfs(i+1, x, y - v[i].s)); ret = max(ret, dfs(i+1,x,y)); ok[i][x][y] = 1; return dp[i][x][y] = ret; } int find_maximum_unique(int x, int y, vector<int>a, vector<int>b) { N = (int)a.size(); v.resize(N); for(int i = 0 ; i < N ; i++) v[i].f = a[i], v[i].s = b[i]; return dfs(0, x, y); }
#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...