Submission #794004

# Submission time Handle Problem Language Result Execution time Memory
794004 2023-07-26T08:38:32 Z NothingXD Highway Tolls (IOI18_highway) C++17
Compilation error
0 ms 0 KB
#include "doll.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef double ld;
typedef complex<ld> point;

void debug_out(){cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
	cerr << H << ' ';
	debug_out(T...);
}

#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)

const int maxn = 4e5 + 10;

int n, m, a[maxn], out[maxn], out1[maxn], out2[maxn], res;
bool mark[maxn];

void solve(int v, int root, vector<int> tmp){
//	debug(v);
//	for (auto x: tmp) debug(x);
	vector<int> l;
	vector<int> r;
	for (int i = 0; i < tmp.size(); i++){
		if (i&1) r.push_back(tmp[i]);
		else l.push_back(tmp[i]);
	}
	bool flgl = false;
	bool flgr = false;
	for (auto x: l) if (x != -1) flgl = true;
	for (auto x: r) if (x != -1) flgr = true;
	if (!flgl){
		out1[v-1] = -root;
	}
	else if (l.size() == 1){
		out1[v-1] = a[l[0]+1];
	}
	else{
		res++;
		out1[v-1] = -res;
		solve(res, root, l);
	}
	if (!flgr){
		out2[v-1] = -root;
	}
	else if (r.size() == 1){
		out2[v-1] = a[r[0]+1];
	}
	else{
		res++;
		out2[v-1] = -res;
		solve(res, root, r);
	}
}

vector<int> Calc(int l, int r){
//	debug(l, r);
	if (l + 1 == r){
		return vector<int>{l};
	}
	int mid = (l + r) >> 1;
	vector<int> lc = Calc(l, mid);
	vector<int> rc = Calc(mid, r);
	vector<int> ans;
	for (int i = 0; i < lc.size(); i++){
		ans.push_back(lc[i]);
		ans.push_back(rc[i]);
	}
	return ans;
}

void create_circuit(int M, vector<int> A) {
	n = A.size(); m = M;
	for (int i = 1; i <= n; i++){
		a[i] = A[i-1];
		mark[a[i]] = true;
	}
	int sz = n+1;
	while(sz % 2 == 0) sz /= 2;
	int bad = 0;
	while(sz != 1){
		bad++;
		sz = n + bad + 1;
		while(sz != 1) sz /= 2;
	}
	sz = n + bad + 1;
	a[n+1] = 0;
	res++;
	out[0] = -1;
	vector<int> ptr = Calc(0, sz);
	vector<int> val;
	int idx = 0;
	for (int i = 0; i < sz; i++){
		if (ptr[i] >= bad){
			val.push_back(idx);
			idx++;
		}
		else{
			val.push_back(-1);
		}
	}
	solve(res, res, val);
	for (int i = 1; i <= m; i++){
		if (mark[i]){
			out[i] = -1;
		}
		else{
			out[i] = 0;
		}
	}
	vector<int> C(m+1), X(res), Y(res);
	for (int i = 0; i <= m; i++){
		C[i] = out[i];
		//debug(i, C[i]);
	}
	//debug(res);
	for (int i = 0; i < res; i++){
		X[i] = out1[i];
		Y[i] = out2[i];
	//	debug(-(i+1), X[i], Y[i]);
	}
	answer(C, X, Y);
}

Compilation message

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