Submission #1288669

#TimeUsernameProblemLanguageResultExecution timeMemory
1288669al95ireyizEaster Eggs (info1cup17_eastereggs)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vll vector<ll>
#define len(x) (ll)x.size()
const ll INF = 1e9, INFL = 1e18;
const ll MOD = 1e9 + 7;
const ll maxn = 2e5 + 5;

ll n, m, k = 0;

#include "grader.h"
vll g[maxn];
vll eu;
void dfs(ll u, ll p = -1){
    eu.pb(u);
    for(auto v : g[u]){
        if(v == p) continue;
        dfs(v, u);
    }
}
int findEgg(int _n, vector<pair<int, int>>_ed){
    n = _n;
    for(ll i = 0; i <= n; i ++) g[i].clear();
    for(auto [x, y] : _ed) g[x].pb(y), g[y].pb(x);
    // beautiful = connected
    // onda euler path uzerinde islemek olar
    dfs(0);
    ll l = 0, r = len(eu) - 1, cv;
    auto get = [&](ll x) -> bool{
        vector<int> v;
        for(ll i = 0; i <= x; i ++) v.pb(eu[i]);
        return query(v);
    }
    while(l <= r){
        ll md = (l + r) >> 1;
        if(get(md)){
            cv = eu[md];
            r = md - 1;
        }
        else{
            l = md + 1;
        }
    }
    return cv;
}
// void _() {

// }
// signed main() {
//     cin.tie(0)->sync_with_stdio(0);
//     ll t = 1;
//     cin >> t;
//     while(t --) _();
// }

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:36:5: error: expected ',' or ';' before 'while'
   36 |     while(l <= r){
      |     ^~~~~