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 r, vector<int> w){
vector<pair<int,int>> v;
int n=w.size();
for(int i=0; i<n; i++){
v.push_back({w[i], i});
}
sort(v.begin(), v.end());
long long sum=0;
vector<int> ans;
int pos=0;
for(int i=0; i<n; i++){
sum+=v[i].first;
while(sum>r){
sum-=v[pos].first;
pos++;
}
if(sum>=l){
for(int j=pos; j<=i; j++) ans.push_back(v[j].second);
break;
}
}
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... |