Submission #408839

# Submission time Handle Problem Language Result Execution time Memory
408839 2021-05-19T17:51:21 Z SirCovidThe19th Crocodile's Underground City (IOI11_crocodile) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int travel_plan(int n, int m, int k, int r[][2], int l[], int p[]){
    vector<vector<pair<int, int>>> adj(n);
    for (int i = 0; i < m; i++){
        adj[r[i][0]].push_back({r[i][1], l[i]});
        adj[r[i][1]].push_back({r[i][0], l[i]});
    }
    priority_queue<pair<long long, int>> trav;
    vector<int> visited(n, 0);
    for (int i = 0; i < k; i++){
        visited[p[i]] = 1;
        trav.push({0, p[i]});
    }
    while (!trav.empty()){
        pair<long long, int> curr = trav.top(); trav.pop();
        visited[curr.second]++;
        if (visited[curr.second] == 2 and curr.second == 0) 
            return -curr.first;
        if (visited[curr.second] == 2)
            for (pair<int, int> elem : adj[curr.second])
                if (visited[elem.first] != 2)
                    trav.push({curr.first-elem.second, elem.first});
    }
}



Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int, int (*)[2], int*, int*)':
crocodile.cpp:5:41: warning: control reaches end of non-void function [-Wreturn-type]
    5 |     vector<vector<pair<int, int>>> adj(n);
      |                                         ^
/usr/bin/ld: /tmp/cceVNfFx.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