Submission #990668

#TimeUsernameProblemLanguageResultExecution timeMemory
990668Ibrohim0704Cyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include <vector> #include <queue> #include <algorithm> using namespace std; #define int long long double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { vector<double> min_time(N, numeric_limits<double>::infinity()); min_time[0] = 0; // Custom comparator for the priority queue auto cmp = [](const pair<double, int>& a, const pair<double, int>& b) { return a.first > b.first; }; priority_queue<pair<double, int>, vector<pair<double, int>>, decltype(cmp)> pq(cmp); pq.push({0, 0}); while (!pq.empty()) { double time = pq.top().first; int country = pq.top().second; pq.pop(); if (country == H) { return time; } for (int i = 0; i < M; ++i) { int neighbor; if (x[i] == country) { neighbor = y[i]; } else if (y[i] == country) { neighbor = x[i]; } else { continue; } double neighbor_time = time + c[i]; if (arr[neighbor] == 2 && K > 0) { neighbor_time /= 2; --K; } if (neighbor_time < min_time[neighbor]) { min_time[neighbor] = neighbor_time; pq.push({neighbor_time, neighbor}); } } } return -1; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccr8xpN8.o: in function `main':
grader.cpp:(.text.startup+0x696): 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