This documentation is automatically generated by online-judge-tools/verification-helper
# noqa: E501 # verify-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_C
from cpl import INF
from cpl.graph.floyd_warshall import floyd_warshall
def main() -> None:
V, _, *std = map(int, open(0).read().split())
graph = [[INF] * V for _ in range(V)]
for i in range(V):
graph[i][i] = 0
for s, t, d in zip(*[iter(std)] * 3):
graph[s][t] = d
dist = floyd_warshall(graph)
# If distance of any node from itself is negative,
# negative cycle is detected.
if any(dist[i][i] < 0 for i in range(V)):
print("NEGATIVE CYCLE")
exit()
[print(" ".join(map(str, row)).replace(str(INF), "INF")) for row in dist]
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