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 <vector>
#include <algorithm>
#include <utility>
using namespace std;
#define v vector
#define pii pair<int,int>
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int N=w.size();
v<pii> mol;
for(int i=0;i<N;i++) mol.push_back({w[i],i});
sort(mol.begin(),mol.end());
v<int> out;
int tot=mol[0].first;
int lb=0;
int ub=1;
while(lb!=N){
if(tot<l){
if(ub!=N) {
ub++;
tot+=mol[ub-1].first;
}
else break;
}
else if(tot>u){
lb++;
tot-=mol[lb-1].first;
}
else{
for(int i=lb;i<ub;i++){
out.push_back(mol[i].second);
}
break;
}
}
return out;
}
# | 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... |