Submission #1019391

# Submission time Handle Problem Language Result Execution time Memory
1019391 2024-07-10T18:49:13 Z stdfloat Crocodile's Underground City (IOI11_crocodile) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "crocodile.h"
#include "grader.cpp"
using namespace std;

#define ff  first
#define ss  second
#define pii pair<int, int>

using ll = long long;

int travel_plan(int n, int M, int R[][2], int L[], int K, int P[]) {
    vector<vector<pii>> E(n);
    for (int i = 0; i < M; i++) {
        E[R[i][0]].push_back({R[i][1], L[i]});
        E[R[i][1]].push_back({R[i][0], L[i]});
    }

    vector<int> vis(n, -1);
    vector<pair<ll, ll>> dis(n, {LLONG_MAX, LLONG_MAX});
    priority_queue<pair<ll, pii>> q;
    for (int i = 0; i < K; i++) {
        vis[P[i]] = -2;
        dis[P[i]] = {0, 0};
        q.push({0, {P[i], -1}});
    }

    while (!q.empty()) {
        ll d = -q.top().ff;
        auto [x, p] = q.top().ss; q.pop();

        if (d != dis[x].ff) continue;

        if (vis[x] == -1 || vis[x] == p) {
            vis[x] = p;

            dis[x] = {dis[x].ss, LLONG_MAX};
            continue;
        }

        for (auto [i, w] : E[x]) {
            if (d + w < dis[i].ss && vis[i] != x) {
                dis[i].ss = d + w;

                if (dis[i].ff > dis[i].ss) swap(dis[i].ff, dis[i].ss);

                q.push({-d - w, {i, x}});
            }
        }
    }

    return dis[0].ff;
}

Compilation message

/usr/bin/ld: /tmp/ccUOp9mM.o: in function `read_input()':
grader.cpp:(.text+0x0): multiple definition of `read_input()'; /tmp/ccGeJrhK.o:crocodile.cpp:(.text+0xb0): first defined here
/usr/bin/ld: /tmp/ccUOp9mM.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccGeJrhK.o:crocodile.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status