# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
672915 |
2022-12-19T01:50:26 Z |
mmk |
Jelly Flavours (IOI20_jelly) |
C++17 |
|
200 ms |
519484 KB |
#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;
for(int i = 1; i <= n && aux >= a[i]; i++)
{
aux -= a[i];
resp++;
}
return resp;
}
//return calc(n, _x, _y);
}
Compilation message
jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
49 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
186 ms |
519484 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 |
186 ms |
519484 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 |
181 ms |
519412 KB |
1st lines differ - on the 1st token, expected: '689', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
183 ms |
519448 KB |
1st lines differ - on the 1st token, expected: '62', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
200 ms |
519392 KB |
1st lines differ - on the 1st token, expected: '154', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
186 ms |
519484 KB |
1st lines differ - on the 1st token, expected: '8', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |