It is a few days to Nowruz (Persian new year), and grandpa has invited his family to his garden. There are
The garden can be represented by an
A maze must have the following property. For each pair
A kid can hide in a cell if and only if that cell is free and has exactly one free neighbor. No two kids can hide in the same cell.
You are given the map of the garden as input. Your task is to help grandpa create a maze in which many kids can hide.
Implementation Details
At IOI, this was an output-only task.
You were given the
Input Specification
Each input file describes one grid representing a garden and gives the number of kids
- line
: - line
: row of the grid, which is a string of length , consisting of the following characters (without any whitespace):.
: a free cell,#
: a rock.
Output Specification
- line
: row of the maze (the garden, after bushes are planted). It is a string of length , consisting of the following characters (without any whitespace):.
: a free cell,#
: a rock,X
: a bush. (Note that the letterX
must be in uppercase.)
Constraints
Scoring
An output file is considered to be valid if all the following conditions are met:
- The output map must match the input map with the only exception that arbitrarily many
.
characters in the input map can be changed toX
characters (cells blocked by bushes). - The output map must have the property of a maze, as defined in the problem statement.
If your output for a test case is not valid, your score for that test case will be
Example
Consider the following input:
4 5 5
....#
.#..#
...#.
....#
Below is a possible valid output:
.X.X#
.#..#
...#X
XX..#
Since O
below:
OXOX#
.#.O#
...#X
XX.O#
The following three outputs are not valid:
.XXX# ...X# XXXX#
.#XX# .#.X# X#XX#
...#. ...#X ..X#X
XX..# XXXX# ..XX#
In the left output there is no simple path between the free cell in the top left corner and the free cell in the rightmost column. In the two other outputs, for each pair of distinct free cells there are exactly two distinct simple paths between them.
Attachment Package
The input files are available here.
Comments