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 "molecules.h"
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define pii pair<int,int>
#define float long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int n=sz(w);
vector<int> idx(n);
iota(all(idx),0);
sort(all(idx),[w](int a,int b)->bool{
return w[a]<w[b];
});
int L=0,sum=0;
for(int R=0;R<n;R++){
if(w[idx[R]]>u) break;
sum+=w[idx[R]];
while(L<=R && sum>u){
sum-=w[idx[L]];
L++;
}
assert(L<=R);
if(sum>=l) return vector<int>(idx.begin()+L,idx.begin()+R+1);
}
return {};
}
# | 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... |