#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
//for randomization
//mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
// #define int long long
#define double long double
#define big __int128_t
#define ulong unsigned long long
#define no cout<<"No"<<endl
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define pb push_back
#define endl '\n'
#define all(v) v.begin(),v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod = 998244353;
const int N = 512;
const int INF = 1e18;
vector<int> g[N],vec;
void dfs(int node, int previous){
vec.pb(node);
for(int to:g[node]){
if(to!=previous) dfs(to,node);
}
}
int findEgg(int n,vector<pair<int,int>> bridges){
vec.clear();
for(auto [u,v]:bridges){
g[u].pb(v);
g[v].pb(u);
}
vec.pb(0);
dfs(1,0);
for(int i =1;i<=n;i++) g[i].clear();
int l = 2, r = n;
int ans =0;
while(l<=r){
int mid = (l+r)/2;
vector<int> v;
for(int i =1;i<=mid;i++) v.pb(vec[i]);
if(query(v)==1){
ans = mid;
r = mid-1;
}
else l =mid+1;
}
return vec[ans];
}
/*
signed main()
{
fastio;
//freopen("closing.in", "r", stdin);
//freopen("closing.out", "w", stdout);
int T =1;
// cin>>T;
while(T--){
solve();
}
}
*/
// tahir
Compilation message (stderr)
eastereggs.cpp:20:18: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
20 | const int INF = 1e18;
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |