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>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
vector<int> find_subset(int l,int u,vector<int> w) {
int n=w.size();
vector<int> ans;
vector<pii> a;
for(int i=0;i<n;++i) a.push_back({w[i],i});
sort(a.begin(),a.end());
int i=0,j=0;
ll sum=0;
for(;j<n;++j) {
while(sum<l) {
if(i>=n) break;
sum+=a[i++].first;
}
if(l<=sum&&sum<=u) break;
sum-=a[j].first;
}
if(!sum) return ans;
for(int x=j;x<=i;++x) ans.push_back(a[x].second);
return ans;
}
# | 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... |