Velociraptors 101

You are on the point of arriving to the ground after your first jump in
parachute, when you discover that somebody has released a group of
velociraptors in the runway. Oh, well! This kind of things happen
sometimes. Now, all of them are quiet, but as soon as you arrive to the
ground, you know they will attack you following the shortest way (they
are smart), and you will remain immobile, gripped by fear and the
material of the parachute.

The runway is rectangular. We mark with a dot the empty spaces, with a
‘V’ the velociraptors, and with a ‘#’ the squares with obstacles (you
cannot land there, and velociraptors cannot cross them). Observe the
test data to get an idea. Velociraptors, that take a second to cover a
square, can move horizontal and vertically, but not in diagonal. You are
asked to mark with a ‘X’ the free squares where, landing in them, you
will maximize your (brief but intense) remaining time life.

Input

A test data contains various cases. Each case starts with a line with
two numbers R and C (dimensions in rows and columns of the runway map).
Then, there are R rows of C characteres each one, with the description
of the map as it has been previously explained.

We assure you that an empty square to land will always exist, therefore,
your life time will always be greater than 0, and there is not any
closed space without velocitaptors, that is, that for any empty square
always exists a velociraptor that can reach it, so your life time will
not be infinite.

Output

For each case, your program must print the map where you will mark with
a ‘X’ the squares that, landing in them, you will maximize your time
life. Separate two maps by a line with 3 dashes ‘---’, as in the
instance.

Scoring

- Test1:   100 cases where 2 ≤ F, C ≤ 10.

- Test1:   50 cases where 2 ≤ F, C ≤ 100.

- Test1:   10 cases where 2 ≤ F, C ≤ 500.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:41:40.143Z

© Jutge.org, 2006–2026.
https://jutge.org
