← Home
For problem statement at 1000-1999/1700-1799/1790-1799/1794/problemB.txt this is a correct solution, but verifier at 1000-1999/1700-1799/1790-1799/1794/verifierB.go ends with case 1 failed
input:
1
7
47 28 17 3 4 38 28

expected:
48 28 17 3 4 38 28

got:
47 28 17 3 4 38 28

exit status 1 can you fix the verifier? package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

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

	for ; t > 0; t-- {
		var n int
		fmt.Fscan(in, &n)

		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a[i])
			if a[i] == 1 {
				a[i]++
			}
		}

		for i := 0; i < n-1; i++ {
			if a[i+1]%a[i] == 0 {
				a[i+1]++
			}
		}

		for i := 0; i < n; i++ {
			if i > 0 {
				out.WriteByte(' ')
			}
			fmt.Fprint(out, a[i])
		}
		out.WriteByte('\n')
	}
}