daylight-library

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub daylight-pro/daylight-library

:heavy_check_mark: ダイクストラ法 (daylight/graph/dijkstra.hpp)

Depends on

Required by

Verified with

Code

#include "daylight/base.hpp"
#include "daylight/graph/base.hpp"
/// @brief ダイクストラ法
/// @param s 始点
/// @param G グラフ
/// @return ret[i]:sからiへの最短経路長
vll dijkstra(int s, const Graph<ll>& G) {
	using P = pair<ll, int>;
	priority_queue<P, vector<P>, greater<>> que;
	vll D(SZ(G), LINF);
	D[s] = 0;
	que.push(P(0, s));
	while(!que.empty()) {
		P p = que.top();
		que.pop();
		int v = p.second;
		if(D[v] < p.first) continue;
		for(Edge e: G[v]) {
			if(D[e.to] > D[v] + e.cost) {
				D[e.to] = D[v] + e.cost;
				que.push(P(D[e.to], e.to));
			}
		}
	}
	return D;
}
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/competitive_verifier/oj_resolve/resolver.py", line 181, in resolve
    bundled_code = language.bundle(path, basedir=basedir)
  File "/home/runner/.local/lib/python3.10/site-packages/competitive_verifier/oj/verify/languages/cplusplus.py", line 252, in bundle
    bundler.update(path)
  File "/home/runner/.local/lib/python3.10/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 482, in update
    self.update(
  File "/home/runner/.local/lib/python3.10/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 477, in update
    raise BundleErrorAt(
competitive_verifier.oj.verify.languages.cplusplus_bundle.BundleErrorAt: daylight/base.hpp: line 103: unable to process #include in #if / #ifdef / #ifndef other than include guards
Back to top page