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 <iostream>
#include <deque>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w){
deque <int> dq;
long long sum = 0;
for(int i = 0; i < (int)w.size(); i++){
sum += w[i];
dq.push_back(i);
while(!dq.empty() && sum > u){
sum -= w[dq.front()];
dq.pop_front();
}
if(l <= sum && sum <= u){
vector <int> ans;
while(!dq.empty()){
ans.push_back(dq.front());
dq.pop_front();
}
return ans;
}
}
return {};
}
/*
4 15 17
6 8 8 7
*/
# | 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... |