#include "jelly.h"
#include <bits/stdc++.h>
using namespace std;
void ckmax(int& a, int b) {a = max(a, b);}
void ckmin(int& a, int b) {a = min(a, b);}
const int N = 12;
int dp[N][501][501];
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
int n = (int) a.size();
for (int i = 0; i < n; i++) {
for (int xx = 0; xx <= x; xx++) {
for (int yy = 0; yy <= y; yy++) {
dp[i][xx][yy] = 0;
}
}
}
dp[0][x][y] = 0;
if (x >= a[0]) dp[0][x - a[0]][y] = 1;
if (y >= b[0]) dp[0][x][y - b[0]] = 1;
for (int i = 1; i < n; i++) {
ckmax(dp[i][x - a[i]][y], 1);
ckmax(dp[i][x][y - b[i]], 1);
for (int j = 0; j < i; j++) {
for (int xx = 0; xx <= x; xx++) {
for (int yy = 0; yy <= y; yy++) {
if (xx + a[i] <= x) {
ckmax(dp[i][xx][yy], dp[j][xx + a[i]][yy] + 1);
}
if (yy + b[i] <= y) {
ckmax(dp[i][xx][yy], dp[j][xx][yy + b[j]] + 1);
}
ckmax(dp[i][xx][yy], dp[j][xx][yy]);
}
}
}
}
int ans = 0;
for (int i = 0; i < n; i++) {
for (int xx = 0; xx <= x; xx++) {
for (int yy = 0; yy <= y; yy++) {
ans = max(ans, dp[i][xx][yy]);
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
9068 KB |
Output is correct |
2 |
Incorrect |
34 ms |
8300 KB |
1st lines differ - on the 1st token, expected: '7', found: '8' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
9068 KB |
Output is correct |
2 |
Incorrect |
34 ms |
8300 KB |
1st lines differ - on the 1st token, expected: '7', found: '8' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
23 ms |
24556 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
28 ms |
24556 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
30 ms |
24600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
9068 KB |
Output is correct |
2 |
Incorrect |
34 ms |
8300 KB |
1st lines differ - on the 1st token, expected: '7', found: '8' |
3 |
Halted |
0 ms |
0 KB |
- |