PivotOJ

Nowruz 1

시간 제한: 1000ms메모리 제한: 512MB출처: IOI 2017BOJ 20067

문제

It is few days to Nowruz (Persian new year), and grandpa has invited his family to his garden. There are kk kids among the guests. To make the gathering more fun for the kids, grandpa is going to run a game of hide-and-seek.

The garden can be represented by an m×nm \times n grid of unit cells. Some (possibly zero) cells are blocked by rocks, and the remaining cells are called free. Two cells are called neighbors if they share an edge. That is, each cell has up to 4 neighbors: two in the horizontal direction, and two in the vertical direction. Grandpa wants to turn his garden into a maze. For this purpose, he can block some free cells by planting bushes in them. The cells where he plants the bushes are no longer free.

A maze must have the following property. For each pair aa and bb of free cells in the maze there must be exactly one simple path between them. A simple path between cells aa and bb is a sequence of free cells in which the first cell is aa, the last cell is bb, all cells are distinct, and each two consecutive cells are neighbors.

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.

This is an output-only task with partial scoring. You are given 1010 input files, each describing grandpa's garden. For each input file you should submit an output file with a map of a maze. For each output file you will get points based on the number of kids that can hide in your maze.

You are not supposed to submit any source code for this task.

입력

Each input file describes one grid representing a garden and gives the number of kids kk invited by grandpa. The format is as follows:

  • line 11:     m    n    k\;\; m \;\; n \;\; k
  • line 1+i1+i (for 1im1 \leq i \leq m): row ii of the grid, which is a string of length nn, consisting of the following characters (without any whitespace):
    • '.': a free cell,
    • '#': a rock.

출력

  • line ii (for 1im1 \leq i \leq m): row ii of the maze (the garden, after bushes are planted). It is a string of length nn, consisting of the following characters (without any whitespace):
    • '.': a free cell,
    • '#': a rock,
    • 'X': a bush. (Note that the letter X must be in uppercase.)

예제

예제 1

입력
4 5 5
....#
.#..#
...#.
....#
출력
.X.X#
.#..#
...#X
XX..#
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.