#include <bits/stdc++.h>
using namespace std;
int find_maximum_unique(int X, int Y, vector<int> a, vector<int> b) {
int N = X + 2 * Y, M = a.size() & 1;
for (auto& x : b)
x *= 2;
vector<vector<int>> dp(2, vector<int> (N + 1, 0));
for (int _ = 0; _ < (int)a.size(); ++_) {
int x = a[_];
int y = b[_];
for (int j = N; j >= x; --j)
dp[_ & 1][j] = max(dp[_ & 1][j], dp[(_ & 1) ^ 1][j - x] + 1);
for (int j = N; j >= y; --j)
dp[_ & 1][j] = max(dp[_ & 1][j], dp[(_ & 1) ^ 1][j - y] + 1);
}
return *max_element(dp[M].begin(), dp[M].end());
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
300 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 |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
300 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 |
Incorrect |
5 ms |
340 KB |
1st lines differ - on the 1st token, expected: '689', found: '1302' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
464 KB |
1st lines differ - on the 1st token, expected: '62', found: '55' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
40 ms |
472 KB |
1st lines differ - on the 1st token, expected: '154', found: '128' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
300 KB |
1st lines differ - on the 1st token, expected: '7', found: '8' |
3 |
Halted |
0 ms |
0 KB |
- |