답안 #863908

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
863908 2023-10-21T11:51:26 Z Ariadna Easter Eggs (info1cup17_eastereggs) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

int query(vector < int > islands);

vector < vector < int > > adj;

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

int findEgg(int N, vector < pair < int, int > >& bridges) {
    adj = vector < vector < int > >(N + 1);
    for (int i = 0; i < N - 1; ++i) {
        int u = bridges[i].first, v = bridges[i].second;
        adj[u].push_back(v);
        adj[v].push_back(u);   
    }

    vector < int > order;
    dfs(1, 1, order);

    int l = 0, r = N - 1;
    while (l < r) {
        vector < int > q;
        int m = (l + r) / 2;
        for (int i = 0; i <= m; ++i) {
            q.push_back(order[i]);
        }
        if (query(q)) r = m;
        else l = m + 1;
    }
    return order[l];
}

Compilation message

/usr/bin/ld: /tmp/ccLC7X7u.o: in function `main':
grader.cpp:(.text.startup+0x1e6): undefined reference to `findEgg(int, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >)'
collect2: error: ld returned 1 exit status