답안 #499577

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499577 2021-12-28T20:07:14 Z speedyArda 악어의 지하 도시 (IOI11_crocodile) C++17
컴파일 오류
0 ms 0 KB
#include "bits/stdc++.h"
#define pb push_back
using ll = long long;
using namespace std;
const int MAXN = 1e5;

vector<int> visited(MAXN + 5);
vector<vector<pair<ll, int> > > adj(MAXN + 5);
int main() 
{
    int n, m, k;
    cin >> n >> m >> k;
    for(int i = 1; i <= m; i++) 
    {
        ll f, s, d;
        cin >> f >> s >> d;
        adj[f].pb({d, s});
        adj[s].pb({d, f});
    }
    set<pair<ll, int> > q;
    for(int i = 1; i <= k; i++) 
    {
        ll f;
        cin >> f;
        q.insert({0, f});
        visited[f] = 1;
    }
    ll ans;
    while(!q.empty()) 
    {
        int v = q.begin()->second;
        ll dist = q.begin()->first;
        q.erase(q.begin());
        if(visited[v] == 0) 
        {
            visited[v] = 1;
            continue;
        }

        if(v == 0) {
            ans = dist;
            break;
        }
        visited[v] = 2;
        for(auto e : adj[v]) 
        {
            int edge = e.second;
            ll cost = e.first;
            if(visited[edge] == 2)
                continue;
            q.insert({cost + dist, edge});
        }
    }
    cout << ans << "\n";

}

Compilation message

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