← Home
For problem statement at 1000-1999/1400-1499/1410-1419/1419/problemB.txt this is a correct solution, but verifier at 1000-1999/1400-1499/1410-1419/1419/verifierB.go ends with wrong answer on case 1
input:
2
99422249038
883636911755
expected:
18
20
got:
35
38exit status 1 can you fix the verifier? package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReaderSize(os.Stdin, 1<<20)
	out := bufio.NewWriterSize(os.Stdout, 1<<20)
	defer out.Flush()

	var t int
	fmt.Fscan(in, &t)

	const INF int64 = 1e18

	var costs []int64
	cur := int64(1)
	for cur <= INF {
		costs = append(costs, cur)
		if cur > (INF-1)/2 {
			break
		}
		cur = cur*2 + 1
	}

	for ; t > 0; t-- {
		var x int64
		fmt.Fscan(in, &x)
		ans := 0
		for _, c := range costs {
			if x < c {
				break
			}
			x -= c
			ans++
		}
		fmt.Fprintln(out, ans)
	}
}