제출 #709634

#제출 시각아이디문제언어결과실행 시간메모리
709634therealpain악어의 지하 도시 (IOI11_crocodile)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 7;

vector <pair <int, int>> adj[N];
bool special[N];
int n, m, k;

namespace sub1 {
    long long dist[1000][1000];
    long long dp[1000][2];

    void dfs1(int u, int p, int root) {
        for (auto [v, w] : adj[u]) {
            if (v == p || v == root) continue;
            dist[root][v] = dist[root][u] + w;
            dfs1(v, u, root);
        }
    }

    void dfs2(int u, int p) {
        if (special[u] == true) {
            dp[u][0] = dp[u][1] = 0;
            return;
        }

        for (auto [v, w] : adj[u]) {
            if (v == p) continue;
            dfs2(v, u);
            if (dp[u][0] > dp[v][1] + w) {
                dp[u][1] = dp[u][0];
                dp[u][0] = dp[v][1] + w;
            } else if (dp[u][1] > dp[v][1] + w) {
                dp[u][1] = dp[v][1] + w;
            }
        }
    }

    void solve() {
        for (int i = 0; i < n; ++i) {
            dfs1(i, i, i);
        }
        memset(dp, 0x3f, sizeof dp);
        dfs2(0, 0);
        cout << dp[0][1];
    }
};

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> m >> k;
    for (int i = 0; i < m; ++i) {
        int u, v, w; cin >> u >> v >> w;
        adj[u].emplace_back(v, w);
        adj[v].emplace_back(u, w);
    }
    for (int i = 0; i < k; ++i) {
        int x; cin >> x;
        special[x] = true;
    }
    sub1::solve();
}

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

/usr/bin/ld: /tmp/ccv0gXTx.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccqThKzx.o:crocodile.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccv0gXTx.o: in function `main':
grader.cpp:(.text.startup+0x36): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status