#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][510][510];
int dp(int x, int y, int i)
{
if(i == nn)return 0;
if(x <0 || y<0)return 0;
if(memo[i][x][y] != -1)return memo[i][x][y];
if(x-aa[i]>=0) memo[i][x][y] = max(memo[i][x][y], dp(x-aa[i], y, i+1)+1);
if(y-bb[i]>=0) max(memo[i][x][y], dp(x, y-bb[i], i+1)+1);
memo[i][x][y]= max (memo[i][x][y], dp(x, y, i+1));
return memo[i][x][y];
}
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<510; j++)
for(int h = 0; h<510; h++)memo[i][j][h]=-1;
int c = 0;
c = dp(x, y, 0);
return c;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1012 ms |
2046364 KB |
1st lines differ - on the 1st token, expected: '8', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1012 ms |
2046364 KB |
1st lines differ - on the 1st token, expected: '8', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1070 ms |
2046660 KB |
1st lines differ - on the 1st token, expected: '689', found: '45' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1327 ms |
2046760 KB |
1st lines differ - on the 1st token, expected: '62', found: '39' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2214 ms |
2046616 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1012 ms |
2046364 KB |
1st lines differ - on the 1st token, expected: '8', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |