Submission #737874

# Submission time Handle Problem Language Result Execution time Memory
737874 2023-05-07T21:47:16 Z Skywk Crocodile's Underground City (IOI11_crocodile) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>

using namespace std;

const int MAXN = 1e5;
vector<pair<int, int>> graph[MAXN+1];
int city[MAXN];
priority_queue<long long> best[MAXN+1];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int N, M, K;
    cin>> N>> M>> K;

    for(int i=0; i<M; i++){
        int u, v, c;
        cin>> u>> v>> c;
        graph[u].push_back({v, c});
        graph[v].push_back({u, c});
    }
    set<pair<long long, int>> pq;
    for(int i=0; i<K; i++){
        cin>> city[i];
        best[city[i]].push(0);
        best[city[i]].push(0);
        pq.insert({0, city[i]});
    }
    while(!pq.empty()){
        auto [d, v] = *pq.begin();
        pq.erase(pq.begin());
        if(best[v].size() < 2 || d != best[v].top()) continue;
        for(auto [u, c] : graph[v]){
            best[u].push(d + c);
            if(best[u].size() > 2){
                if(best[u].top() == d + c){
                    best[u].pop();
                    continue;
                }
                pq.erase({u, best[u].top()});
                best[u].pop();
            }
            pq.insert({d + c, u});
        }
    }
    cout<< best[0].top();
    return 0;   
}

Compilation message

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