Submission #851976

# Submission time Handle Problem Language Result Execution time Memory
851976 2023-09-21T02:48:27 Z AtabayRajabli Easter Eggs (info1cup17_eastereggs) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> g;
vector<int> order;

void dfs(int v, int prev)
{
    order.push_back(v);

    for(int i : g[v])
    {
        if(i == prev)continue;

        dfs(i, v);
    }
}

int findEgg(int n, vector<pair<int, int>> bridges)
{
    g.clear();
    order.clear();

    g.resize(n+1);

    for(auto it : bridges)
    {
        int u = it.first, v = it.second;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    dfs(1, 0);

    int l = 0, r = n-1;
    while(l < r)
    {
        int mid = (l + r) / 2 + 1;

        if(query(vector<int> (order.begin(), order.begin() + mid)))
            r = mid;
        else
            l = mid + 1;
    }
    return order[l];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:41:12: error: 'query' was not declared in this scope
   41 |         if(query(vector<int> (order.begin(), order.begin() + mid)))
      |            ^~~~~