This documentation is automatically generated by online-judge-tools/verification-helper
//go:build ignore
// verification-helper: PROBLEM https://onlinejudge.u-aizu.ac.jp/courses/library/5/GRL/1/GRL_1_B
package main
import (
"bufio"
"fmt"
"math"
"os"
"strconv"
"github.com/today2098/algorithm-go/algorithm"
)
var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)
func getInt() int {
sc.Scan()
elem, err := strconv.Atoi(sc.Text())
if err != nil {
panic(err)
}
return elem
}
func out(x ...any) {
fmt.Fprintln(wr, x...)
}
func main() {
sc.Split(bufio.ScanWords)
sc.Buffer([]byte{}, math.MaxInt32)
defer wr.Flush()
n, m, r := getInt(), getInt(), getInt()
bf := algorithm.NewDefaultBellmanFord(n)
for i := 0; i < m; i++ {
s, t, d := getInt(), getInt(), getInt()
bf.AddEdge(s, t, d)
}
if bf.BellmanFord(r) {
out("NEGATIVE CYCLE")
return
}
for i := 0; i < n; i++ {
ans := bf.Distance(i)
if ans == bf.Infinity() {
out("INF")
} else {
out(ans)
}
}
}
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: verify/aoj-GRL_1_B-bellman_ford.test.go