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 db long double
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio\
ios_base::sync_with_stdio(0);\
cin.tie(0);\
cout.tie(0)\
vi sub[550];
vi g[550];
void dfs(int node, int par){
sub[node].push_back(node);
for(int i : g[node]){
if(i == par) continue;
dfs(i, node);
for(int j : sub[i]){
sub[node].push_back(j);
}
}
}
int findEgg (int n, vii bridges){
for(pii i : bridges){
g[i.first].push_back(i.second);
g[i.second].push_back(i.first);
}
dfs(1, 1);
int cur = 1;
while(true){
int nxt = -1;
for(int i : g[cur]){
if(query(sub[i])){
nxt = i;
break;
}
}
if(nxt == -1) return cur;
cur = nxt;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |