제출 #1308586

#제출 시각아이디문제언어결과실행 시간메모리
1308586vaishakhv악어의 지하 도시 (IOI11_crocodile)C++20
컴파일 에러
0 ms0 KiB
// Source: https://usaco.guide/general/io

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

const ll cap = 1e6+1;

vector<pair<ll,ll>> adj[cap];

int main() {
	ios::sync_with_stdio(0);
    cin.tie(0);

    ll n, m, k; cin >> n >> m >> k;
    vector<ll> exits;

    for (ll i{}; i < m; i++){
        ll a, b, w; cin >> a >> b >> w;
        adj[a].push_back({b,w});
        adj[b].push_back({a,w});
    }

    priority_queue<pair<ll,ll>> pq;

    vector<ll> dp(n, -1);
    vector<ll> cnt(n, 0);

    for (ll i = 0; i < k; i++){
        ll a; cin >> a;
        cnt[a] = 1;        
        dp[a] = 0;       
        pq.push({0, a});   
    }

    while(!pq.empty()){
        pair<ll,ll> top = pq.top(); pq.pop();
        ll dist = -top.first, u = top.second;

        if (cnt[u] == 2) continue;
        cnt[u]++;

        if (cnt[u] == 1) continue;

        dp[u] = dist;
        for (auto [v,w]: adj[u]){
            if (cnt[v] < 2) pq.push({-(dist + w), v});
        }        
    }

    cout << dp[0];
}

컴파일 시 표준 에러 (stderr) 메시지

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