Submission #758266

# Submission time Handle Problem Language Result Execution time Memory
758266 2023-06-14T10:40:31 Z ivaziva Crocodile's Underground City (IOI11_crocodile) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#define MAXN 100010

long long n;
long long m;
long long k;
vector<pair<long long,long long>> adj[MAXN];
long long pos[MAXN];
priority_queue<pair<long long,long long>,vector<pair<long long,long long>>,greater<pair<long long,long long>>> pq;
long long dist1[MAXN];
long long dist2[MAXN];
long long niz[MAXN];

int main()
{
    cin>>n>>m>>k;
    for (long long i=1;i<=m;i++)
    {
        long long x;
        long long y;
        long long z;
        cin>>x>>y>>z;
        adj[x].push_back({y,z});
        adj[y].push_back({x,z});
    }
    for (long long i=0;i<MAXN;i++)
    {
        dist1[i]=LLONG_MAX;
        dist2[i]=LLONG_MAX;
    }
    for (long long i=1;i<=k;i++)
    {
        cin>>niz[i];
        dist1[niz[i]]=0;
        dist2[niz[i]]=0;
        pq.push({0,niz[i]});
        pos[niz[i]]=1;
    }
    while (pq.empty()==false)
    {
        long long node0=pq.top().second;
        long long dist0=pq.top().first;
        pq.pop();
        if (dist2[node0]<dist0) continue;
        if (pos[node0]>1) continue;
        if (pos[node0]==1)
        {
            long long s=adj[node0].size();
            for (long long i=0;i<s;i++)
            {
                long long node=adj[node0][i].first;
                long long dist=adj[node0][i].second;
                if (dist0+dist<dist1[node])
                {
                    dist2[node]=dist1[node];
                    dist1[node]=dist0+dist;
                    pq.push({dist1[node],node});
                }
                else if (dist0+dist<dist2[node])
                {
                    dist2[node]=dist+dist0;
                    pq.push({dist2[node],node});
                }
            }
        }
        pos[node0]++;
    }
    cout<<dist2[0]<<endl;
}

Compilation message

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