Submission #397268

# Submission time Handle Problem Language Result Execution time Memory
397268 2021-05-01T19:17:17 Z peuch Shortcut (IOI16_shortcut) C++17
Compilation error
0 ms 0 KB
#include "molecules.h"
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;

vector<int> getAns(vector<pair<int, int> > aux, int ini, int fim);

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
	int n = w.size();
	
	vector<int> ret;
	vector<pair<int, int> > aux;
	for(int i = 0; i < w.size(); i++)
		aux.push_back(make_pair(w[i], i));
	sort(aux.begin(), aux.end()); 
 	
	vector<int> suf, pref;
	suf.push_back(aux[0].first);
	pref.push_back(aux[n - 1].first);
 	
	for(int i = 1; i < n; i++)
		suf.push_back(suf[suf.size() - 1] + aux[i].first);
 	for(int i = n - 2; i >= 0; i--)
		pref.push_back(pref[pref.size() - 1] + aux[i].first);
 	
	if(suf[n - 1] < l) return ret;
	if(suf[0] > u) return ret;
 	
 	
	if(suf[n - 1] <= u) return getAns(aux, n - 1, n);
 	
	for(int i = 0; i < n; i++){
		if(suf[i] > u) break;
		if(suf[i] >= l) return getAns(aux, i, n + 1);
		int k = lower_bound(pref.begin(), pref.end(), l - suf[i]) - pref.begin();
		if(k == pref.size()) continue;
		if(k + 1 + i + 1 > n) continue;
		if(suf[i] + pref[k] > u) continue;
		if(suf[i] + pref[k] < l) continue;
		k = n - 1 - k;
		if(k <= i) continue;
		return getAns(aux, i, k);
	}
 	
	int k = lower_bound(pref.begin(), pref.end(), l) - pref.begin();
 	
 	if(k == pref.size()) return ret;
 	if(pref[k] > u) return ret;
 	if(pref[k] < l) return ret;
 	k = n - 1 - k;
    return getAns(aux, -1, k);
}

vector<int> getAns(vector<pair<int, int> > aux, int ini, int fim){
	vector<int> ret;
	for(int i = 0; i <= ini; i++)
		ret.push_back(aux[i].second);
	for(int i = aux.size() - 1; i >= fim; i--)
		ret.push_back(aux[i].second);
	sort(ret.begin(), ret.end());
	return ret;
}

Compilation message

shortcut.cpp:1:10: fatal error: molecules.h: No such file or directory
    1 | #include "molecules.h"
      |          ^~~~~~~~~~~~~
compilation terminated.