# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
61981 | minhcool | Easter Eggs (info1cup17_eastereggs) | C++17 | 76 ms | 3108 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
typedef pair<int, int> ii;
const int N = 1e5 + 5;
int a[N], cur;
vector<int> gr[N];
void dfs(int u, int p) {
a[++cur] = u;
for (int v : gr[u]) if(v != p) dfs(v, u);
}
int findEgg(int n, vector<ii> edge) {
for (int i = 0; i < N; ++i) gr[i].clear();
for (ii i : edge) {
gr[i.fi].pb(i.se); gr[i.se].pb(i.fi);
}
dfs(1, 1);
vector<int> ask;
int l = 1, r = n;
while(l < r) {
int mid = l + r >> 1;
ask.clear();
for (int i = 1; i <= mid; ++i) ask.pb(a[i]);
if(query(ask)) r = mid;
else l = mid + 1;
}
return a[l];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |