#include <bits/stdc++.h>
using namespace std;
const int c=10002, p=2002, sok=1e9;
int n, maxi, regi[2*c], uj[2*c];
bool v[p];
vector<pair<int, int> > yr;
vector<pair<pair<int, int>, int> > xr;
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
n=a.size();
for (int i=0; i<n; i++) {
xr.push_back({{a[i], b[i]}, i});
yr.push_back({b[i], i});
}
sort(xr.begin(), xr.end()), sort(yr.begin(), yr.end());
for (int i=0; i<=x; i++) regi[i]=sok, uj[i]=sok;
regi[0]=0;
for (int i=0; i<n; i++) {
int fi=xr[i].first.first, se=xr[i].first.second, id=xr[i].second;
v[id]=1;
for (int i=x; i>=0; i--) {
uj[i]=min(uj[i], regi[i]+se);
uj[i+fi]=min(uj[i+fi], regi[i]);
}
regi[0]=uj[0], uj[0]=sok;
for (int i=1; i<=x; i++) regi[i]=min(uj[i], regi[i-1]), uj[i]=sok;
int sum=0;
if (regi[x]<=y) maxi=max(maxi, i+1);
for (int j=0; j<n; j++) {
int fi=yr[j].first, se=yr[j].second;
if (!v[se]) {
sum+=fi;
if (regi[x]+sum<=y) maxi=max(maxi, i+j+2);
}
}
}
return maxi;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
1st lines differ - on the 1st token, expected: '8', found: '11' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
1st lines differ - on the 1st token, expected: '8', found: '11' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
384 KB |
1st lines differ - on the 1st token, expected: '689', found: '707' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
512 KB |
Output is correct |
2 |
Correct |
69 ms |
764 KB |
Output is correct |
3 |
Correct |
69 ms |
684 KB |
Output is correct |
4 |
Incorrect |
63 ms |
512 KB |
1st lines differ - on the 1st token, expected: '1906', found: '3796' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
59 ms |
512 KB |
1st lines differ - on the 1st token, expected: '154', found: '307' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
1st lines differ - on the 1st token, expected: '8', found: '11' |
2 |
Halted |
0 ms |
0 KB |
- |