#include <bits/stdc++.h>
#include "eastereggs.h"
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
};
template <typename T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
};
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
for (int i = 0; i < v.size(); i++) {
os << v[i] << (i + 1 == v.size() ? "\n" : " ");
}
return os;
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
for (auto &e : t) {
fill_v(e, v);
}
};
int n;
vector<vector<int>> G;
vector<int> v, vis;
void dfs(int i, int p) {
v.push_back(i);
for (auto &e : G[i]) {
if (e == p) {
continue;
}
dfs(e, i);
v.push_back(i);
}
}
int findEgg(int N, vector<pair<int, int>> bridges) {
n = N;
G.resize(N);
vis.resize(N);
for (int i = 0; i < N - 1; i++) {
bridges[i].first--;
bridges[i].second--;
G[bridges[i].first].push_back(bridges[i].second);
G[bridges[i].second].push_back(bridges[i].first);
}
dfs(0, -1);
int l = 0, r = v.size();
int t = n;
while (1) {
set<int> st;
int m;
for (int i = l; i < r; i++) {
if (!vis[v[i]]) {
st.insert(v[i]);
if (st.size() >= t / 2) {
m = i;
break;
}
}
}
vector<int> to;
for (auto it = st.begin(); it != st.end(); it++) {
to.push_back(*it + 1);
}
if (query(to)) {
for (int i = 0; i < n; i++) {
if (!st.count(i)) {
vis[i] = 1;
}
}
r = m + 1;
t = to.size();
} else {
for (int i = 0; i < n; i++) {
if (st.count(i)) {
vis[i] = 1;
}
}
l = m + 1;
t -= to.size();
}
if (t == 1) {
for (int i = l; i < r; i++) {
if (!vis[v[i]]) {
return v[i] + 1;
}
}
}
}
}
Compilation message
eastereggs.cpp:2:10: fatal error: eastereggs.h: No such file or directory
#include "eastereggs.h"
^~~~~~~~~~~~~~
compilation terminated.