| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1264299 | liangjeremy | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 0 KiB | 
#include<bits/stdc++.h>
#define fi first
#define se second
//#define int long long
using namespace std;
using db=double;
using ll=int64_t;
using sll=__int128;
using lb=long double;
int find_subset(int l, int r, vector<int>w){
	int n=w.size(); vector<pair<int,int>>a(n);
	for(int i=0; i<n; i++)a[i]={w[i],i};
	sort(a.begin(),a.end()); ll sum=0; int ridx=0;
	for(int i=0; i<n; i++){
		if(sum<l && ridx<n){
			sum+=a[ridx].fi; ridx++;
		}
		if(sum>=l && sum<=r){
			vector<int>ans;
			for(int j=i; j<=ridx; j++)ans.push_back(j);
			return ans;
		}
	}
	return vector<int>(); 
}
