This documentation is automatically generated by competitive-verifier/competitive-verifier
#include "lib/graph/dijkstra_potential.hpp"#pragma once
#include <functional>
#include <limits>
#include <queue>
#include <vector>
#include "graph/graph.hpp"
/// @brief ダイクストラ法
template <class T, class U>
std::vector<T> dijkstra(const Graph<T> &g, const std::vector<U> &potentials, int s = 0,
T inf = std::numeric_limits<T>::max()) {
struct _node {
constexpr _node() : _to(), _dist() {}
constexpr _node(int to, T dist) : _to(to), _dist(dist) {}
constexpr bool operator<(const _node &rhs) const { return this->dist() < rhs.dist(); }
constexpr bool operator>(const _node &rhs) const { return rhs < *this; }
constexpr int to() const { return this->_to; }
constexpr T dist() const { return this->_dist; }
private:
int _to;
T _dist;
};
int n = g.size();
std::vector<T> dists(n, inf);
std::priority_queue<_node, std::vector<_node>, std::greater<>> p_que;
dists[s] = T();
p_que.emplace(s, T());
while (!p_que.empty()) {
auto node = p_que.top();
p_que.pop();
if (dists[node.to()] < node.dist()) continue;
for (auto &e : g[node.to()]) {
auto next_dist = node.dist() + e.weight() + potentials[node.to()] - potentials[e.to()];
if (next_dist < dists[e.to()]) {
dists[e.to()] = next_dist;
p_que.emplace(e.to(), next_dist);
}
}
}
for (int i = 0; i < n; ++i) dists[i] += potentials[i] - potentials[s];
return dists;
}
Traceback (most recent call last):
File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/resolver.py", line 291, in resolve
bundled_code = language.bundle(path, basedir=basedir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus.py", line 242, in bundle
bundler.update(path)
File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 479, in update
self._resolve(pathlib.Path(included), included_from=path)
File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 286, in _resolve
raise BundleErrorAt(path, -1, "no such header")
competitive_verifier.oj.verify.languages.cplusplus_bundle.BundleErrorAt: graph/graph.hpp: line -1: no such header