VvyLw's Library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub

:warning: Java/library/graph/ShortestPath.java

Depends on

Required by

Code

package library.graph;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * 最短路クラス
 */
public final class ShortestPath {
	private final long[] cost;
	private final int[] src;
	/**
	 * コンストラクタ
	 * @param cost
	 * @param src
	 */
	public ShortestPath(final long[] cost, final int[] src) {
		this.cost = cost;
		this.src = src;
	}
	/**
	 * 経路があるかどうか判定する
	 * @param i
	 * @return 経路があるか
	 */
	public final boolean isThru(final int i){ return src[i] != -1; }
	/**
	 * 経路復元
	 * @param i
	 */
	public final int[] path(int i) {
		final List<Integer> res = new ArrayList<>();
		for(; i != -1; i = src[i]) {
			res.add(i);
		}
		Collections.reverse(res);
		return res.stream().mapToInt(k -> k).toArray();
	}
	/**
	 * 全点間の最短コストを返す
	 * @return 全点間の最短コスト
	 */
	public final long[] get(){ return cost; }
}
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/user_defined.py", line 68, in bundle
    raise RuntimeError('bundler is not specified: {}'.format(str(path)))
RuntimeError: bundler is not specified: Java/library/graph/ShortestPath.java
Back to top page