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 x first
#define y second
#define ll long long int
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<pair<int,int> > ww;
for(int i=0; i<(int)w.size(); i++) {
ww.push_back({w[i],i});
}
sort(ww.begin(),ww.end());
vector<int> ans;
int a=0;
int r=0;
int n=(int)w.size();
ll sum=0;
while(r<n&&a<n) {
sum+=ww[r].x;
//cout<<sum<<endl;
while(sum>u) {
sum-=ww[a].x;
a++;
}
if(sum>=l&&sum<=u) {
for(int i=a; i<=r; i++) {
ans.push_back(ww[i].y);
}
return ans;
}
r++;
}
return std::vector<int>(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... |