Uolevi has developed a game where the player collects coins in a maze.
At the moment, the problem is that the game is too easy. Could you design some challenging mazes for the game?
Each maze is a rectangular grid that consists of floors (
) and walls (
). One of the cells is a base (
), and some cells can contain coins (
). The player begins in the base, and can move left, right, up and down. The task of the player is to collect all coins in the maze and then return to the base.
The difficulty of a maze is the length of the shortest path that begins in the base, collects all coins and returns to the base.
The input begins with an integer $t$: the number of mazes. After this, $t$ lines follow. Each such line contains three integers $n$, $m$ and $k$. This means that the size of the maze must be $n \times m$ cells and there must be exactly $k$ coins.
The output should contain $t$ maze descriptions, separated by empty lines, in the same order as in the input. Each maze must be solvable.
3 3 1
4 7 2
The difficulty of the first maze is 4, and the difficulty of the second maze is 18.
This is an output only task and there is only one input file (maze.in). You can download the input file here
. You have to submit an output file (maze.out) that contains all the mazes specified in the input file.
For each maze, your score is $\max(0,100-3(d-x))$ where $x$ is the difficulty of your maze and $d$ is the difficulty of the most challenging maze found by the jury. Your total score for the task is the average of all scores rounded down to an integer.