Submission #926813

# Submission time Handle Problem Language Result Execution time Memory
926813 2024-02-13T20:12:46 Z tomb Crocodile's Underground City (IOI11_crocodile) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vb vector<bool>
#define vvb vector<vb>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpii vector<pii>
#define vpli vector<pli>
#define vpil vector<pil>
#define vpll vector<pll>
#define ll long long
#define vll vector<ll>
#define vvll vector<vll>
#define f first
#define s second
#define pb push_back
#define MAXN (int) 1e5


ll travel_plan(int n, int m, int **R, int *L, int k, int *P){
    vector<vpll> adj(n);
    for (int i = 0; i < m; i++)
        adj[R[i][0]].pb({R[i][1], L[i]}), adj[R[i][1]].pb({R[i][0], L[i]});
    
    priority_queue<pli, vpli, greater<pli>> pq;
    pq.push({0, 0});
    vll dist(n, 2e18), dist2(n, 2e18), par(n, -1);
    vb vis(n);
    dist[0] = dist2[0] = 0;
    while (pq.size()){
        int u; ll w;
        tie (w, u) = pq.top();
        if (vis[u]) continue;
        vis[u] = true;
        pq.pop();
        for (auto [v, cost] : adj[u]){
            if (dist[v] > dist[u] + cost)
                pq.push({dist[v] = dist[u] + cost, v}), par[v] = u;
                
        }
    }
    vis.assign(n, 0);

    while (pq.size()){
        int u; ll w;
        tie (w, u) = pq.top();
        if (vis[u]) continue;
        vis[u] = true;
        pq.pop();
        for (auto [v, cost] : adj[u]){
            if (dist2[v] > dist2[u] + cost && par[v] != u)
                pq.push({dist2[v] = dist2[u] + cost, v});
                
        }
    }
    ll min_cost = LLONG_MAX;
    for (int i = 0; i < k; i++)
        min_cost = min(min_cost, dist2[P[i]]);
    
    return min_cost;
}


Compilation message

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