#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
vector< vector<int> > g;
vector<int> found, st;
int check(vector<int> v, int cur) {
v.push_back(cur);
return (Query(v) < (int) v.size());
}
void find(vector<int>& v, int cur) {
while (check(v, cur)) {
int lo = 0, hi = (int) v.size() - 1;
while (lo < hi) {
int mid = (lo + hi) / 2;
if (check(vector<int>(v.begin(), v.begin() + mid + 1), cur)) {
hi = mid;
} else {
lo = mid + 1;
}
}
found.push_back(v[lo]);
v = vector<int>(v.begin() + lo + 1, v.end());
}
}
}
void Solve(int N) {
g.resize(2 * N + 1);
st.resize(2 * N + 1);
st[1] = 0;
for (int i = 2; i <= 2 * N; i++) {
found.clear();
vector<int> a, b;
for (int j = 1; j < i; j++) {
if (st[j] == 0) {
a.push_back(j);
} else {
b.push_back(j);
}
}
find(a, i);
find(b, i);
if (found.empty()) {
st[i] = 0;
} else {
for (auto& x : found) {
st[i] = !st[x];
g[i].push_back(x);
g[x].push_back(i);
}
}
}
vector<int> used(2 * N + 1, 0), in(2 * N + 1, -1), out(2 * N + 1, -1);
for (int i = 1; i <= 2 * N; i++) {
if ((int) g[i].size() == 1) {
continue;
}
if (Query({i, g[i][0], g[i][1]}) == 1) {
out[i] = g[i][2];
in[g[i][2]] = i;
} else if (Query({i, g[i][0], g[i][2]}) == 1) {
out[i] = g[i][1];
in[g[i][1]] = i;
} else {
out[i] = g[i][0];
in[g[i][0]] = i;
}
}
for (int i = 1; i <= 2 * N; i++) {
if (used[i]) {
continue;
}
for (auto& x : g[i]) {
if (x != in[i] && x != out[i]) {
Answer(i, x);
used[i] = used[x] = 1;
}
}
}
}
Compilation message
joitter2.cpp:1:10: fatal error: chameleon.h: No such file or directory
#include "chameleon.h"
^~~~~~~~~~~~~
compilation terminated.