For problem statement at 2000-2999/2000-2099/2080-2089/2082/problemB.txt this is a correct solution, but verifier at 2000-2999/2000-2099/2080-2089/2082/verifierB.go ends with All 65 tests passed. can you fix the verifier? package main
import (
"io"
"os"
"strconv"
)
func minVal(x, n, m int64) int64 {
for m > 0 && x > 1 {
x = (x + 1) / 2
m--
}
if x == 0 {
return 0
}
if x == 1 {
if n > 0 {
return 0
}
return 1
}
for n > 0 && x > 0 {
x /= 2
n--
}
return x
}
func maxVal(x, n, m int64) int64 {
for n > 0 && x > 0 {
x /= 2
n--
}
if x <= 1 {
return x
}
for m > 0 && x > 1 {
x = (x + 1) / 2
m--
}
return x
}
func main() {
data, _ := io.ReadAll(os.Stdin)
idx := 0
nextInt := func() int64 {
for idx < len(data) && (data[idx] < '0' || data[idx] > '9') && data[idx] != '-' {
idx++
}
sign := int64(1)
if idx < len(data) && data[idx] == '-' {
sign = -1
idx++
}
var v int64
for idx < len(data) && data[idx] >= '0' && data[idx] <= '9' {
v = v*10 + int64(data[idx]-'0')
idx++
}
return v * sign
}
t := int(nextInt())
out := make([]byte, 0, t*24)
for i := 0; i < t; i++ {
x := nextInt()
n := nextInt()
m := nextInt()
a := minVal(x, n, m)
b := maxVal(x, n, m)
out = strconv.AppendInt(out, a, 10)
out = append(out, ' ')
out = strconv.AppendInt(out, b, 10)
out = append(out, '\n')
}
os.Stdout.Write(out)
}