# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
61643 | huynhsmd | Easter Eggs (info1cup17_eastereggs) | C++17 | 46 ms | 3056 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"
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef pair <int , int > ii;
const int N = 1e5 + 5;
int arr[N], cnt = 0;
vector < int > adj[N], ask;
void dfs(int u, int p){
arr[++cnt] = u;
for(int v : adj[u]) if(v != p) dfs(v, u);
}
int findEgg(int N, vector < ii > bridges){
int n = N;
for(int i = 1; i <= n; ++ i) adj[i].clear();
for(ii i : bridges) adj[i.fi].pb(i.se), adj[i.se].pb(i.fi);
dfs(1, 1);
int l = 1, r = n, res;
while(l < r){
int mid = l + r >> 1;
ask.clear();
for(int i = 1; i <= mid; ++ i) ask.pb(arr[i]);
if(query(ask)) r = mid;
else l = mid + 1;
}
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... |