답안 #851959

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
851959 2023-09-21T02:17:37 Z AtabayRajabli Easter Eggs (info1cup17_eastereggs) C++17
컴파일 오류
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, order, g);
    }
}

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 'int findEgg(int, std::vector<std::pair<int, int> >)':
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];
      |            ^