답안 #539287

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
539287 2022-03-18T16:12:03 Z Soumya1 도서관 (JOI18_library) C++17
컴파일 오류
0 ms 0 KB
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
#include "library.h"
#include "debug_local.h"
using namespace std;
void Solve(int n) {
	vector<int> edge[n + 1];
	vector<int> old(n);
	int old_answer = 0;
	for (int i = 1; i <= n; i++) {
		vector<int> nw = old;
		nw[i - 1] = 1;
		int new_answer = Query(nw);
		debug(old_answer, new_answer);
		if (old_answer + 1 == new_answer) {
			old_answer = new_answer;
			old = nw;
			continue;
		}
		int lo = 1, hi = i - 1;
		while (lo < hi) {
			int mid = (lo + hi) / 2;
			vector<int> q(n);
			for (int j = 1; j <= mid; j++) q[j - 1] = 1;
			// debug(q);
			int x = Query(q);
			q[i - 1] = 1;
			int y = Query(q);
			// debug(x, q, y);
			if (y > x) lo = mid + 1;
			else hi = mid;
			// debug(lo, hi);
		}
		// cout << lo << " " << i << endl;
		edge[lo].push_back(i);
		edge[i].push_back(lo);
		if (new_answer < old_answer) {
			lo = 1, hi = i - 1;
			while (lo < hi) {
				int mid = (lo + hi) / 2;
				vector<int> q(n);
				for (int j = 1; j <= mid; j++) q[j - 1] = 1;
				int x = Query(q);
				q[i - 1] = 1;
				int y = Query(q);
				if (x <= y) lo = mid + 1;
				else hi = mid;
			}
			edge[lo].push_back(i);
			edge[i].push_back(lo);
		}
		old_answer = new_answer;
		old = nw;
	}
	int start;
	for (int i = 1; i <= n; i++) {
		if ((int) edge[i].size() == 1) start = i;
	}
	vector<bool> vis(n + 1);
	vector<int> ans;
	while ((int) ans.size() < n) {
		ans.push_back(start);
		vis[start] = true;
		for (int next : edge[start]) {
			if (!vis[next]) {
				start = next;
				break;
			}
		}
	}
	Answer(ans);
}

Compilation message

library.cpp:5:10: fatal error: debug_local.h: No such file or directory
    5 | #include "debug_local.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.