#include<bits/stdc++.h>
#include<jelly.h>
using namespace std;
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
int n = a.size(); int counter = 0; int answer = 0; vector<int> uebersprungene = {};
if (x > y) swap(x, y);
sort(a.begin(), a.end());
int sum_x = 0;
while ((sum_x + a[counter]) <= x && counter < n) {
sum_x += a[counter];
answer += 1; counter += 1;
}
bool possible = true;
while (possible) {
if (sum_x - a[counter-1] + a[counter] <= x) {
sum_x = sum_x - a[counter-1] + a[counter];
uebersprungene.push_back(a[counter-1]);
counter += 1;
} else possible = false;
}
int sum_y = 0;
for (auto j : uebersprungene) {
if (sum_y + j <= y) {
sum_y += j;
answer += 1;
}
}
while ((sum_y + a[counter]) <= y && counter < n) {
sum_y += a[counter];
answer += 1; counter += 1;
}
return answer;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
1st lines differ - on the 1st token, expected: '8', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
1st lines differ - on the 1st token, expected: '8', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
1st lines differ - on the 1st token, expected: '689', found: '58' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
1st lines differ - on the 1st token, expected: '62', found: '64' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
380 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Incorrect |
1 ms |
364 KB |
1st lines differ - on the 1st token, expected: '1965', found: '1966' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
1st lines differ - on the 1st token, expected: '8', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |