이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "grader.h"
#define uwu return
using namespace std;
const int SIZE = 513;
vector <int> graph[SIZE];
#define fs first
#define sc second
void dfs(vector <int>& vertices, int nd, int rt){
vertices.push_back(nd);
for(auto i:graph[nd]){
if(i != rt)
dfs(vertices, i, nd);
}
return;
}
int findEgg (int N, vector <pair<int, int>> bridges){
for(auto i:bridges){
graph[i.fs].push_back(i.sc);
graph[i.sc].push_back(i.fs);
}
vector <int> vertices;
dfs(vertices, 1, 0);
int L = 0, R = N - 1, M;
while(L != R){
vector <int> tmp = vertices;
M = (L + R) / 2;
tmp.erase(tmp.begin() + M, tmp.end());
if(query(tmp))
R = M;
else
L = M + 1;
}
return vertices[L];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |