제출 #1337631

#제출 시각아이디문제언어결과실행 시간메모리
1337631vladilius이주 (IOI25_migrations)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define pb push_back
#define ff first
#define ss second

vector<int> p;

int find(int u){
    int n = (int) p.size();

    vector<int> g[n];
    for (int i = 1; i < n; i++){
        g[p[i]].pb(i);
        g[i].pb(p[i]);
    }
    
    function<pii(int, int)> dfs = [&](int v, int pr){
        pii out = {0, v};
        for (int i: g[v]){
            if (i == pr) continue;
            auto [d, x] = dfs(i, v);
            out = max(out, {d + 1, x});
        }
        return out;
    };
    
    return dfs(u, 0).ss;
}

int f, g;

int send_message(int n, int i, int k){
    if (i == 1) p.pb(0);
    p.pb(k);
    
    if (i == (n - 2)){
        f = find(0);
        g = find(f);
        return f;
    }
    
    if (i == (n - 1)){
        if (find(0) != f){
            return 1e4 + g;
        }
        return find(f);
    }
    
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

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