답안 #984856

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
984856 2024-05-17T07:28:24 Z 54skyxenon 악어의 지하 도시 (IOI11_crocodile) C++17
컴파일 오류
0 ms 0 KB
// https://oj.uz/problem/view/IOI11_crocodile

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define INF LLONG_MAX

vector<map<int, int>> graph;
vector<bool> is_exit;
vector<bool> visited;

int dfs(int curr) {
    if (is_exit[curr]) {
        return 0;
    }

    vector<int> distances;
    for (auto [nei, weight] : graph[curr]) {
        if (!visited[nei]) {
            visited[nei] = true;
            distances.push_back(weight + dfs(nei));
        }
    }

    sort(distances.begin(), distances.end());
    return distances[1];
}

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

    int n, m, k;
    cin >> n >> m >> k;

    graph.resize(n);
    for (int i = 0; i < m; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        graph[u][v] = graph[v][u] = w;
    }

    is_exit.resize(n);
    visited.resize(n);
    for (int i = 0; i < k; i++) {
        int p;
        cin >> p;
        is_exit[p] = true;
    }

    visited[0] = true;
    cout << dfs(0) << '\n';
}

Compilation message

/usr/bin/ld: /tmp/ccWTFFNP.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccBzPHNQ.o:crocodile.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccWTFFNP.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