For problem statement at 1000-1999/1400-1499/1420-1429/1420/problemC2.txt this is a correct solution, but verifier at 1000-1999/1400-1499/1420-1429/1420/verifierC2.go ends with output mismatch
expected:
7
11
14
13
13
13
20
18
23
18
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
3
3
14
14
14
13
17
6
5
6
5
18
20
20
20
18
1
4
4
2
2
2
2
2
13
10
16
16
24
24
1
1
1
1
1
1
17
18
23
21
21
24
24
20
26
26
25
25
24
24
1
1
1
7
5
5
21
4
3
3
3
4
3
9
9
8
9
9
8
4
4
4
3
3
4
2
2
2
2
2
1
1
1
1
1
1
10
11
13
12
16
4
3
11
13
13
13
10
4
4
3
3
3
4
4
3
3
3
12
16
4
2
10
9
12
13
5
6
6
5
4
4
10
9
10
8
9
8
7
11
12
12
11
12
20
18
22
22
23
8
9
8
8
11
12
15
14
16
18
3
3
3
4
4
3
3
3
3
3
9
8
2
2
2
2
22
22
25
20
18
15
1
1
1
1
1
1
1
22
22
8
9
8
12
11
13
12
10
17
16
17
20
20
21
21
13
14
13
17
14
1
1
1
1
1
11
3
17
15
17
18
19
19
6
6
6
16
16
21
20
14
16
20
20
16
16
13
7
7
7
9
9
20
20
19
19
27
4
4
4
4
4
6
6
6
11
12
7
1
1
11
12
3
3
3
4
5
9
12
9
7
11
4
4
4
4
4
4
11
10
10
10
3
4
4
3
4
3
2
2
2
2
2
25
24
19
25
15
15
18
25
23
5
14
2
2
2
2
2
14
15
17
4
5
6
2
2
2
19
20
3
got:
7 11 11 11 10
12 19
12 7 12
1 1 1 1 1 1
2 2 2 2 2
2 2 2 2 2
1 1 1 1 1
3 3
11 13 13 9 10
4 4 6 4
14 15 15 15 14
1
4 4
2 2 2 2 2
11 8 16 16
19 18
1 1 1 1 1 1
16 16 22
16 16 11 11
20
24 19 17 22 22 22
1 1 1
7 4 4
21
4 3 3 3 4 3
8 7 6 7 7
8
4 4 4 3 3 4
2 2 2 2 2
1 1 1 1 1 1
5 8 13 10
14
4 3
10
12 12 12 8
4 4 3 3 3
4 4 3 3 3
12 16
4
2
7 7 9 7
4 4 4 5 4 4
10 9 10
5 8 5 6
11 12 10 9 10
20 18 22 22 23
8
9 7 7 11 12
11 11 15 17
3 3 3 4 4
3 3 3 3 3
9 8
2 2 2 2
21 21 24 19
17
11
1 1
1 1 1 1 1
17 13
8 9 8 8 7 8
9 9
16 16 16
14 14 17 17
12 13 12
16
11
1 1 1 1 1
8
3
17 12 12 17 19 19
6 5 6
12 12
18 17 13 14 19 19
16 16 13
7 6 6 7 7
18 18 17 17
27
4 4 4 4 4
6 5 4
8 9
6
1 1
9 11
3 3 3 4
4
7 10 9 7 11
4 4 4 4 4 4
11 10 10 10
3 4 4 3 4 3
2 2 2 2 2
23 23 18 22
12 12 15 25 23
4
11
2 2 2 2 2
12 14 14
4 5 6
2 2 2
19 20
3
exit status 1 can you fix the verifier? ```go
package main
import (
"bufio"
"fmt"
"os"
)
type node struct {
even, odd int64
}
var tree []node
var a []int
func max(x, y int64) int64 {
if x > y {
return x
}
return y
}
func combine(left, right node) node {
od := max(left.even+right.odd, left.odd-right.even)
ev := max(left.even+right.even, left.odd-right.odd)
return node{ev, od}
}
func build(idx, l, r int) {
if l == r {
tree[idx] = node{0, int64(a[l])}
return
}
mid := (l + r) / 2
build(2*idx, l, mid)
build(2*idx+1, mid+1, r)
tree[idx] = combine(tree[2*idx], tree[2*idx+1])
}
func update(idx, l, r, pos int, val int64) {
if l == r {
tree[idx] = node{0, val}
return
}
mid := (l + r) / 2
if pos <= mid {
update(2*idx, l, mid, pos, val)
} else {
update(2*idx+1, mid+1, r, pos, val)
}
tree[idx] = combine(tree[2*idx], tree[2*idx+1])
}
func main() {
in := bufio.NewScanner(os.Stdin)
in.Split(bufio.ScanWords)
readInt := func() int {
in.Scan()
var x int
fmt.Sscan(in.Text(), &x)
return x
}
t := readInt()
for ; t > 0; t-- {
n := readInt()
q := readInt()
a = make([]int, n+1)
for i := 1; i <= n; i++ {
a[i] = readInt()
}
tree = make([]node, 4*(n+1))
build(1, 1, n)
ans := []int64{}
ans = append(ans, max(tree[1].even, tree[1].odd))
for i := 0; i < q; i++ {
l := readInt()
r := readInt()
temp := a[l]
a[l] = a[r]
a[r] = temp
update(1, 1, n, l, int64(a[l]))
update(1, 1, n, r, int64(a[r]))
ans = append(ans, max(tree[1].even, tree[1].odd))
}
for i, v := range ans {
if i > 0 {
fmt.Print(" ")
}
fmt.Print(v)
}
fmt.Println()
}
}
```