# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
433483 | JUANDI321 | Jelly Flavours (IOI20_jelly) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "jelly.h"
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
vector<int> aa(2010), bb(2010);
vector<int> ax(11), by(11);
int nn;
int memo[2020][500][500];
int dp(int x, int y, int i, int ca)
{
if(i == nn && ca == 1)return-1;
if(i == nn)return 0;
if(x <0 || y<0)return 0;
if(memo[i][x][y] != -1)return memo[i][x][y];
return memo[i][x][y]= max(dp(x-aa[i], y, i+1, 1)+1, max(dp(x, y-bb[i], i+1, 1)+1, dp(x, y, i+1, 0)));
}
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
int n = a.size();
nn = n;
for(int i = 0; i<n; i++)
{
aa[i]=a[i];
bb[i]=b[i];
}//cout<<"hola"<<endl;
for(int i = 0; i<2010; i++)
for(int j = 0; j<500; j++)
for(int h = 0; h<500; h++)memo[i][j][h]=-1;
int c = 0;
c = dp(x, y, 0);
return c;
}