Submission #667095

# Submission time Handle Problem Language Result Execution time Memory
667095 2022-11-30T11:31:07 Z ansgar Crocodile's Underground City (IOI11_crocodile) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <crocodile.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pii>
#define vvpii vector<vpii>
#define vb vector<bool>
#define vc vector<char>
#define vvc vector<vc>
#define vvb vector<vb>
#define si set<int>
#define mii map<int,int>

const int mod=1e9+7;
const int N=2e5+1;
const int LN=LLONG_MAX/10;
struct com{
    bool operator()(pair<pii,int>& a,pair<pii,int>& b){
        return a.second>b.second;
    }
};
struct co{
    bool operator()(pii& a,pii& b){
        return a.second>b.second;
    }
};
int travel_plan(int n,int m,int R[][2],int L[],int k,int P[]){
    vvpii G(n);
    for(int i=0;i<m;i++){
        G[R[i][0]].push_back({R[i][1],L[i]});
        G[R[i][1]].push_back({R[i][0],L[i]});
    }
    priority_queue<pair<pii,int>,vector<pair<pii,int>>,com> Q;
    for(int i=0;i<k;i++){
        Q.push({{P[i],P[i]},0});
    }
    vi bloq(n,LN);
    while(Q.size()){
        int u=Q.top().first.first;
        int p=Q.top().first.second;
        int wu=Q.top().second;
        Q.pop();
        if(bloq[u]!=LN)continue;
        bloq[u]=p;
        for(auto x : G[u]){
            int v=x.first;
            int wv=x.second;
            if(bloq[v]==LN)Q.push({{v,u},wu+wv});
        }
    }
    vi dist(n,LN);
    priority_queue<pii,vpii,co> Q2;
    Q2.push({0,0});
    while(Q2.size()){
        int u=Q2.top().first;
        int wu=Q2.top().second;
        Q2.pop();
        if(dist[u]!=LN)continue;
        dist[u]=wu;
        for(auto x : G[u]){
            int v=x.first;
            int wv=x.second;
            if(bloq[u]==v)continue;
            if(dist[v]==LN)Q2.push({v,wu+wv});
        }
    }
    int sol=LN;
    for(int i=0;i<k;i++){
        sol=min(sol,dist[P[i]]);
    }
    if(sol==LN)return -1;
    return sol;
}

Compilation message

/usr/bin/ld: /tmp/ccvAIhD3.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