| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 57832 | robert | Detecting Molecules (IOI16_molecules) | C++14 | 106 ms | 31836 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
#include "molecules.h"
using namespace std;
vector<int> find_subset(int l, int u, vector<int> wt){
	vector<pair<int, int> > w;
	for(int z=0; z<wt.size(); z++)
		w.push_back({wt[z], z});
	sort(w.begin(), w.end());
	vector<int> res;
	long long sum = 0;
	int x = 0;
	for(; x<w.size(); x++){
		sum += w[x].first;
		if(sum>=l)
			break;
	}
//	cout << sum << endl;
	if(sum<l)
		return res;
	if(sum<=u){
		//solution 0...x
		for(int z=0; z<=x; z++){
			res.push_back(w[z].second);
		}
		return res;
	}
	int y = 0; sum -= w[x].first;
	while(x<w.size()){
		if(sum>=l&&sum<=u)
			break;
		sum -= w[y++].first;
		sum += w[x++].first;
		if(sum>=l&&sum<=u)
			break;
	}
	if(sum<l)
		return res;
	for(int z=y; z<x; z++){
		res.push_back(w[z].second);
	}
	return res;
}
/*
int main(){
	vector<int> r = {15, 17, 16, 18};
	vector<int> a = find_subset(10, 20, r);
	for(int x=0; x<a.size(); x++)
		cout << a[x] << endl;
}*/
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
