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;
const int sz = 600;
vector<int> aj[sz];
vector<int> pt;
void dfs(int v, int p = -1) {
pt.push_back(v);
for (int u : aj[v]) if (u != p)
dfs(u, v);
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
for (auto& [v, u] : bridges) {
aj[v].push_back(u);
aj[u].push_back(v);
}
dfs(1);
int le = 0, ri = N + 1;
while (1 < ri - le) {
int mi = le + (ri - le) / 2;
vector<int> q;
for (int i = 1; i <= mi; i ++)
q.push_back(pt[i - 1]);
int r = query(q);
if (r) ri = mi;
else le = mi;
}
return pt[ri - 1];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |