For problem statement at 2000-2999/2100-2199/2160-2169/2164/problemE.txt this is a correct solution, but verifier at 2000-2999/2100-2199/2160-2169/2164/verifierE.go ends with reference runtime error: exec: "ref2164E.bin": executable file not found in $PATH can you fix the verifier? package main
import (
"io"
"os"
"strconv"
)
type FastScanner struct {
data []byte
idx int
n int
}
func NewFastScanner() *FastScanner {
data, _ := io.ReadAll(os.Stdin)
return &FastScanner{data: data, n: len(data)}
}
func (fs *FastScanner) NextInt() int {
for fs.idx < fs.n && fs.data[fs.idx] <= ' ' {
fs.idx++
}
val := 0
for fs.idx < fs.n {
b := fs.data[fs.idx]
if b < '0' || b > '9' {
break
}
val = val*10 + int(b-'0')
fs.idx++
}
return val
}
func find(x int, p []int) int {
r := x
for p[r] != r {
r = p[r]
}
for p[x] != x {
nx := p[x]
p[x] = r
x = nx
}
return r
}
func main() {
fs := NewFastScanner()
t := fs.NextInt()
out := make([]byte, 0, t*24)
const inf int64 = 1 << 60
for ; t > 0; t-- {
n := fs.NextInt()
m := fs.NextInt()
size := 2*n + 5
dsu := make([]int, size)
parent := make([]int, size)
left := make([]int, size)
right := make([]int, size)
val := make([]int64, size)
best := make([]int64, size)
parity := make([]byte, size)
for i := 1; i <= n; i++ {
dsu[i] = i
val[i] = inf
}
tot := n
var sum int64
for i := 0; i < m; i++ {
u := fs.NextInt()
v := fs.NextInt()
w := int64(fs.NextInt())
sum += w
if u != v {
parity[u] ^= 1
parity[v] ^= 1
}
ru := find(u, dsu)
rv := find(v, dsu)
if ru == rv {
if w < val[ru] {
val[ru] = w
}
} else {
tot++
val[tot] = w
left[tot] = ru
right[tot] = rv
parent[ru] = tot
parent[rv] = tot
dsu[ru] = tot
dsu[rv] = tot
dsu[tot] = tot
}
}
if tot > n {
for u := tot; u >= n+1; u-- {
if parent[u] == 0 {
best[u] = val[u]
} else if val[u] < best[parent[u]] {
best[u] = val[u]
} else {
best[u] = best[parent[u]]
}
}
}
var extra int64
for u := n + 1; u <= tot; u++ {
pl := parity[left[u]]
pr := parity[right[u]]
if pl == 1 && pr == 1 {
extra += best[u]
}
parity[u] = pl ^ pr
}
ans := sum + extra
out = strconv.AppendInt(out, ans, 10)
out = append(out, '\n')
}
_, _ = os.Stdout.Write(out)
}