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 "jelly.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005, MAX = 1e4+5;
int dp[MAXN][MAX];
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
int n = a.size();
sort(a.begin(),a.end());
int l = 1, r = n;
while(l!=r){
int mid = (l+r+1)/2;
int curx = x, cury = y;
for(int i = mid-1; i >= 0; i--){
if(curx > cury)curx -= a[i];
else cury -= a[i];
}
if(curx >= 0 && cury >= 0)l = mid;
else r = mid-1;
}
int curx = x, cury = y;
for(int i = l-1; i >= 0; i--){
if(curx > cury)curx -= a[i];
else cury -= a[i];
}
if(curx >= 0 && cury >= 0) return l;
return 0;
}
# | 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... |