This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |