답안 #470998

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
470998 2021-09-06T14:59:22 Z vishesh312 Easter Eggs (info1cup17_eastereggs) C++17
컴파일 오류
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
*/

#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define sz(x) (int)(x).size()

using ll = long long;
const int mod = 1e9+7;

void dfs(int u, int p, vector<vector<int>> &adj, vector<int> &o) {
    o.push_back(u);
    for (int v : adj[u])
        if (v != p)
            dfs(v, u, adj, o);
}

int findEgg(int n, vector<pair<int, int>> bridges) {
    vector<vector<int>> adj(n+1);
    vector<int> o;
    for (auto [u, v] : bridges) {
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(0, -1, adj, o);
    int l = 0, r = n;
    auto chk = [&] (int m) -> bool {
        vector<int> v(o.begin(), o.begin() + m);
        return query(v);
    };
    while (l < r) {
        int m = (l + r) / 2;
        if (chk(m)) {
            r = m;
        } else {
            l = m+1;
        }
    }
    return o[r];
}

Compilation message

eastereggs.cpp: In lambda function:
eastereggs.cpp:34:16: error: 'query' was not declared in this scope
   34 |         return query(v);
      |                ^~~~~