← Home
For problem statement at 0-999/900-999/970-979/976/problemB.txt this is a correct solution, but verifier at 0-999/900-999/970-979/976/verifierB.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, k int64
	fmt.Fscan(in, &n, &m, &k)

	if k < n {
		fmt.Fprintln(out, k+1, 1)
		return
	}

	t := k - n
	idx := t / (m - 1)
	pos := t % (m - 1)
	row := n - idx
	var col int64
	if idx%2 == 0 {
		col = 2 + pos
	} else {
		col = m - pos
	}

	fmt.Fprintln(out, row, col)
}