Submission #1010131

# Submission time Handle Problem Language Result Execution time Memory
1010131 2024-06-28T10:59:20 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;

vector<bool> ext, vis;

vector<ll> v;

vector<vector<pii>> E;

void dfs(int x, int p = -1) {
    vis[x] = true;

    if (ext[x]) return v[x] = 0, void();

    for (auto [i, w] : E[x]) {
        if (!vis[i]) dfs(i, x);
    }

    vector<ll> u;
    for (auto [i, w] : E[x]) {
        if (i != p && v[i] != LLONG_MAX) u.push_back(v[i] + w);
    }

    sort(u.begin(), u.end());

    if (1 < (int)u.size()) v[x] = u[1];
}

int travel_plan(int n, int M, int R[][2], int L[], int K, int P[]) {
    E.assign(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]});
    }

    ext.assign(n, false);
    for (int i = 0; i < K; i++) {
        ext[P[i]] = true;
    }

    vis.assign(n, false);
    v.assign(n, LLONG_MAX);
    dfs(0);

    return v[0];
}

Compilation message

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