AtCoder-Library

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

View the Project on GitHub ryusuke920/AtCoder-Library

:heavy_check_mark: Test/AOJ/GRL/GRL_1_B.test.py

Code

# verification-helper: PROBLEM https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_B

import sys
sys.path.append("../../../")

from Graph import BellmanFord
from Search import BreadthFirstSearch_graph

def main() -> None:
    V, E, r = map(int, input().split())
    s, t, d = [0] * E, [0] * E, [0] * E

    g = [[] for _ in range(V)]
    for i in range(E):
        s[i], t[i], d[i] = map(int, input().split())
        g[s[i]].append(t[i])

    dist = BreadthFirstSearch_graph.bfs(V, g, r)
    judge = [False] * V

    for i in range(V):
        if dist[i] != float('inf'):
            judge[i] = True
    
    g = []
    for i in range(E):
        if judge[s[i]]:
            g.append((s[i], t[i], d[i]))

    ans = BellmanFord.bellman_ford(V, g, r)
    if ans == -1:
        print('NEGATIVE CYCLE')
    else:
        for i in range(V):
            if ans[i] == float('inf'):
                print('INF')
            else:
                print(ans[i])


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