Submission #1196247

#TimeUsernameProblemLanguageResultExecution timeMemory
1196247GoBananas69Cyberland (APIO23_cyberland)C++20
Compilation error
0 ms0 KiB
#include <iostream> #include <algorithm> #include <vector> #include <queue> using std::vector; using std::pair; vector<vector<pair<double, double>>> adj; vector<bool> vis; vector<double> dist; double solve(double n, double m, double k, double h, vector<double> x, vector<double> y, vector<double> c, vector<double> arr) { adj.assign(n, {}); vis.assign(n, false); dist.assign(n, 0); for (double i = 0; i<m; ++i) { double u = x[i], v = y[i], w = c[i]; adj[u].push_back({v, w}); adj[v].push_back({u, w}); } std::queue<double> q; dist[0] = 0; q.push(0); while (!q.empty()) { double u = q.front(); q.pop(); if (vis[u]) continue; vis[u] = true; for (auto &p: adj[u]) { double v = p.first; double w = p.second; dist[v] = dist[u] + w; if (v == h) { return dist[v]; } q.push(v); } } if (vis[h] == false) return -1; else return dist[h]; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccMSDcgF.o: in function `main':
grader.cpp:(.text.startup+0x71e): undefined reference to `solve(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status