← Home
For problem statement at 0-999/200-299/210-219/215/problemC.txt this is a correct solution, but verifier at 0-999/200-299/210-219/215/verifierC.go ends with All tests passed 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 n, m, s int
	fmt.Fscan(in, &n, &m, &s)

	var ans int64

	for u := 1; u <= n; u += 2 {
		wx := n - u + 1
		cntV := (u + 1) / 2
		amax := (u - 1) / 2

		for p := 1; p <= m; p += 2 {
			wy := m - p + 1
			weight := int64(wx) * int64(wy)
			up := u * p

			if up == s {
				cntQ := (p + 1) / 2
				total := 2*cntV*cntQ - 1
				ans += weight * int64(total)
			}

			if up > s && amax > 0 {
				diff := up - s
				if diff&3 == 0 {
					bmax := (p - 1) / 2
					if bmax > 0 {
						D := diff / 4
						lim := amax
						if D < lim {
							lim = D
						}
						cnt := 0
						for e := 1; e <= lim; e++ {
							if D%e == 0 {
								f := D / e
								if f <= bmax {
									cnt++
								}
							}
						}
						ans += weight * int64(2*cnt)
					}
				}
			}
		}
	}

	fmt.Fprint(out, ans)
}