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 <bits/stdc++.h>
#include <molecules.h>
using namespace std;
using ll = long long; 
// u - l >= wmax - wmin
// what does this mean for me
vector<int> find_subset(int l, int u, vector<int> w){
	vector<int> ret;
	vector<pair<int, int>> ww;
	int n = w.size();
	for(int i =0; i < n; i++){
		ww.push_back({w[i], i});
	}	
	sort(ww.begin(), ww.end());
	if(ww[0].first >= l && ww[0].first<= u){
		ret.push_back(ww[0].second);
		return ret;
	}
	int z = 0;
	ll sum = ww[0].first;
	for(int i =1; i < n; i++){
		sum += ww[i].first;
		while(sum > u && z < n){
			sum -= ww[z].first;
			z++;
		}
		if(sum >= l && sum <= u){
			for(int j = z; j <= i; j++){
				ret.push_back(ww[j].second);
			}
			return ret;
		}
	}
	return ret;
}
// int main(){
// 	int l = 15;
// 	int u = 20;
// 	vector<int> w = {7, 8, 12, 12}; 
// 	vector<int> ret = find_subset(l, u, w);
// 	for(int x : ret){
// 		cout << x << " ";
// 	}
// 	cout << endl;
// }
| # | 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... |