#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] != 0) return dp[i][x][y];
int uga, buga, duga;
uga = 0;
buga = 0;
if(x >= a[i]) uga = calc(i-1,x-a[i],y);
if (y >= b[i]) buga = calc(i-1, x, y - b[i]);
duga = calc(i-1,x,y);
return 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));
cout << calc(n, _x, _y) << '\n';
}
Compilation message
jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:35:1: warning: no return statement in function returning non-void [-Wreturn-type]
35 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
596 ms |
1046412 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
596 ms |
1046412 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
610 ms |
1046612 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
642 ms |
1046660 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
598 ms |
1046672 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
596 ms |
1046412 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |