제출 #917626

#제출 시각아이디문제언어결과실행 시간메모리
917626NonozeDetecting Molecules (IOI16_molecules)C++17
100 / 100
38 ms6352 KiB
#include "molecules.h"

#include <bits/stdc++.h>
using namespace std;

vector<int> find_subset(int l, int r, vector<int> temp) {
	vector<int> ans;
	int n=temp.size();
	vector<pair<int, int>> w;
	for (int i = 0; i < n; ++i)
	{
		w.push_back({temp[i], i});
	}
	sort(w.begin(), w.end());
	long long sum=0;
	int beg=0;
	for (int i=0; i<n; i++) {
		sum+=w[i].first;
		while (sum>r) sum-=w[beg++].first;
		if (sum>=l) {
			for (int j=beg; j<=i; j++) ans.push_back(w[j].second);
			return ans;
		}
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...