verify/collections/ppunionfind/past_ppuf_test_.nim

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

:warning: verify/collections/ppunionfind/past_ppuf_test_.nim

Depends on

Code

# verification-helper: PROBLEM https://atcoder.jp/contests/past202004-open/tasks/past202004_o
import cplib/collections/ppunionfind
import algorithm

proc scanf(formatstr: cstring){.header: "<stdio.h>", varargs.}
proc ii(): int {.inline.} = scanf("%lld\n", addr result)

var N,M = ii()
var UF = initPartialPersistentUnionFind(N)

var edges : seq[(int,int,int)]
for i in 0..<(M):
    var a,b  = ii()-1
    var c = ii()
    edges.add((c,a,b))
var save = edges
edges.sort()
var tmp = 0
for i in 0..<(M):
    var (c,a,b) = edges[i]
    if UF.unite(a,b,i):
        tmp += c

for i in 0..<(M):
    var (c,a,b) = save[i]
    echo tmp+c-edges[UF.when_unite(a,b)][0]
Traceback (most recent call last):
  File "/home/runner/.local/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 "/home/runner/.local/lib/python3.12/site-packages/onlinejudge_verify/languages/nim.py", line 86, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page