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;
vector<int> find_subset(int l, int u, vector<int> w){
vector<pair<int,int>> info; int n = w.size();
for(int i = 0;i<n;++i){
info.push_back({w[i],i});
}
sort(info.begin(),info.end());
int j = -1; long long cursum = 0;
for(int i = 0;i<n;++i){
while(j+1 < n && cursum < l){
j++;
cursum += info[j].first;
}
if(l <= cursum && cursum <= u){
vector<int> ans;
for(int k = i;k<=j;++k) ans.push_back(info[k].second);
return ans;
}
cursum -= info[i].first;
}
return 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... |