cpl-python3

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

View the Project on GitHub yaumu3/cpl-python3

:heavy_check_mark: test/yosupo/shortest_path.test.py

Code

# verify-helper: PROBLEM https://judge.yosupo.jp/problem/shortest_path
from cpl import INF, pairwise
from cpl.graph.dijkstra import Dijkstra


def main() -> None:
    N, _, s, t, *abc = map(int, open(0).read().split())
    G = [[] for _ in range(N)]
    for a, b, c in zip(*[iter(abc)] * 3):
        G[a].append((b, c))
    d = Dijkstra(G, s)
    mc = d.min_cost(t)
    if mc == INF:
        print(-1)
        exit()

    path = d.min_cost_path(t)
    print(mc, len(path) - 1)
    for u, v in pairwise(path):
        print(u, v)


if __name__ == "__main__":
    main()
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/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 "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page