답안 #1018122

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018122 2024-07-09T14:55:29 Z stdfloat 악어의 지하 도시 (IOI11_crocodile) C++17
컴파일 오류
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<bool> vis(n);
    vector<pair<ll, ll>> dis(n, {LLONG_MAX, LLONG_MAX});
    priority_queue<pair<ll, int>> q;
    for (int i = 0; i < K; i++) {
        vis[P[i]] = true;
        dis[P[i]] = {0, 0};
        q.push({0, P[i]});
    }

    while (!q.empty()) {
        auto [d, x] = q.top(); d = -d; q.pop();
    
        if (d != dis[x].ff) continue;

        if (!vis[x]) {
            vis[x] = true;

            dis[x].ff = dis[x].ss;
            dis[x].ss = LLONG_MAX;

            if (dis[x].ff != LLONG_MAX) q.push({-dis[x].ff, x});            
            continue;
        }

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

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

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

    return dis[0].ff;
}

Compilation message

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