#include "jelly.h"
#include <bits/stdc++.h>
using namespace std;
int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
int n = (int) a.size();
vector<pair<int, int>> jellies(n);
for (int i = 0; i < n; i++) {
jellies[i].first = a[i];
jellies[i].second = b[i];
}
sort(jellies.begin(), jellies.end());
int res = 0;
for (int i = 0; i < n; i++) {
int sum = 0;
for (int j = i; j < n; j++) {
if (sum + jellies[j].first > x) {
break;
}
sum += jellies[j].first;
int cur = j - i + 1;
vector<int> rem;
for (int k = 0; k < n; k++) {
if (k >= i && k <= j) {
continue;
}
rem.push_back(jellies[k].second);
}
sort(rem.begin(), rem.end());
int tmp = y;
for (int& cost : rem) {
if (tmp - cost >= 0) {
tmp -= cost;
++cur;
}
}
res = max(res, cur);
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
307 ms |
332 KB |
1st lines differ - on the 1st token, expected: '689', found: '683' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
206 ms |
332 KB |
Output is correct |
2 |
Correct |
221 ms |
336 KB |
Output is correct |
3 |
Correct |
219 ms |
332 KB |
Output is correct |
4 |
Execution timed out |
2082 ms |
332 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1132 ms |
332 KB |
Output is correct |
2 |
Correct |
269 ms |
332 KB |
Output is correct |
3 |
Correct |
245 ms |
344 KB |
Output is correct |
4 |
Execution timed out |
2085 ms |
300 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
2 |
Halted |
0 ms |
0 KB |
- |