Submission #851956

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

using namespace std;

void dfs(int v, int prev, vector<int> &order, vector<vector<int>> &g)
{
    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)
{
    vector<vector<int>> g(n+1, vector<int>(n+1));
    vector<int> order;

    for(auto &[u, v] : bridges)
    {
        g[u].push_back(v);
        g[v].push_back(u);
    }

    dfs(1, 0, order, g);

    int l = 0, r = 0;
    while(l <= r)
    {
        int mid = (l + r) >> 1;

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

Compilation message

eastereggs.cpp: In function 'void dfs(int, int, std::vector<int>&, std::vector<std::vector<int> >&)':
eastereggs.cpp:13:17: error: too few arguments to function 'void dfs(int, int, std::vector<int>&, std::vector<std::vector<int> >&)'
   13 |         dfs(i, v);
      |                 ^
eastereggs.cpp:5:6: note: declared here
    5 | void dfs(int v, int prev, vector<int> &order, vector<vector<int>> &g)
      |      ^~~
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:19:27: error: 'n' was not declared in this scope
   19 |     vector<vector<int>> g(n+1, vector<int>(n+1));
      |                           ^
eastereggs.cpp:22:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   22 |     for(auto &[u, v] : bridges)
      |               ^
eastereggs.cpp:35:30: error: expected primary-expression before 'ask'
   35 |         if(query(vector<int> ask(order.begin(), order.begin() + mid)))
      |                              ^~~
eastereggs.cpp:35:12: error: 'query' was not declared in this scope
   35 |         if(query(vector<int> ask(order.begin(), order.begin() + mid)))
      |            ^~~~~
eastereggs.cpp:40:12: error: 'q' was not declared in this scope
   40 |     return q[l];
      |            ^