Submission #946742

# Submission time Handle Problem Language Result Execution time Memory
946742 2024-03-15T01:49:36 Z PenguinsAreCute Mutating DNA (IOI21_dna) C++17
Compilation error
0 ms 0 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> find_subset(int l, int u, vector<int> w) {
	int n = w.size();
	vector<pair<int,int>> ww(n);
	for(int i=0;i<n;i++) ww[i]={w[i],i};
	sort(w.begin(),w.end());
	sort(ww.begin(),ww.end());
	ll pre[n], post[n];
	for(int i=-1;++i<n;) pre[i]=w[i]+(i?pre[i-1]:0);
	for(int i=n;i--;) post[i]=w[i]+(i==n-1?0:post[i+1]);
	for(int i=-1;++i<n;) if(pre[i]<=u&&post[n-1-i]>=l) {
		ll cur=pre[i];
		vector<int> v(i+1); for(int j=-1;++j<=i;) v[j]=ww[j].second;
		if(cur>=l) return v;
		for(int j=-1;++j<=min(i,n-i);) {
			cur += w[n-1-j] - w[j];
			v[j] = ww[n-1-j].second;
			if(cur>=l) return v;
		}
	}
	return {};
}
// 26 lines

Compilation message

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