제출 #672911

#제출 시각아이디문제언어결과실행 시간메모리
672911mmkJelly Flavours (IOI20_jelly)C++14
35 / 100
876 ms1046604 KiB
#include "jelly.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 510; const int INF = 0x3f3f3f3f; int dp[MAXN][MAXN][MAXN]; int n, a[MAXN], b[MAXN]; int calc(int i, int x, int y) { if (i == 0) return 0; if (dp[i][x][y] != -1) return dp[i][x][y]; int uga = 0, buga = 0, duga = 0; if (x >= a[i]) uga = calc(i - 1, x - a[i], y) + 1; if (y >= b[i]) buga = calc(i - 1, x, y - b[i]) + 1; duga = calc(i - 1, x, y); return dp[i][x][y] = max(uga, max(buga, duga)); } int find_maximum_unique(int _x, int _y, vector<int> _a, vector<int> _b) { n = _a.size(); for (int i = 1; i <= n; i++) { a[i] = _a[i - 1]; b[i] = _b[i - 1]; } memset(dp, -1, sizeof(dp)); if(_y == 0) { sort(a+1,a+(n+1)); int aux = _x; int resp = 0; int i = 1; while(aux > 0) { if(aux >= a[i]) { resp ++; aux -= a[i]; i++; } else break; } return resp; } return calc(n, _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...