Submission #386583

# Submission time Handle Problem Language Result Execution time Memory
386583 2021-04-07T02:38:35 Z Kepha Crocodile's Underground City (IOI11_crocodile) C++11
Compilation error
0 ms 0 KB
// IOI 2011 crocodile
#include <bits/stdc++.h>
#define MX 100000
using namespace std;

int N, M, K;
vector<pair<int, int> > edges[MX + 1];
int dist1[MX + 1], dist2[MX + 1];
bool visited[MX + 1];
priority_queue<pair<int, int> > q;

int main() {
    // ifstream cin("tmp");

    cin >> N >> M >> K;

    for (int i = 1; i <= M; i++) {
        int a, b, c; cin >> a >> b >> c;
        edges[a].push_back({b, c});
        edges[b].push_back({a, c});
    }

    memset(dist1, 0x3f, sizeof(dist1));
    memset(dist2, 0x3f, sizeof(dist2));

    for (int i = 1; i <= K; i++) {
        int x; cin >> x;
        dist1[x] = dist2[x] = 0;
        q.push({0, x});
    }

    while (q.size()) {
        int node = q.top().second;
        q.pop();

        if (visited[node]) continue;
        visited[node] = true;

        for (auto& edge : edges[node]) {
            if (dist2[node] + edge.second < dist1[edge.first]) {
                dist2[edge.first] = dist1[edge.first];
                dist1[edge.first] = dist2[node] + edge.second;
                q.push({-dist2[edge.first], edge.first});
            }
            else if (dist2[node] + edge.second < dist2[edge.first]) {
                dist2[edge.first] = dist2[node] + edge.second;
                q.push({-dist2[edge.first], edge.first});
            }
        }
    }

    cout << dist2[0] << "\n";
    return 0;
}

Compilation message

/tmp/cc6zPbjB.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccdplyXI.o:crocodile.cpp:(.text.startup+0x0): first defined here
/tmp/cc6zPbjB.o: In function `main':
grader.cpp:(.text.startup+0x32): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status