Woburn Challenge 2018-19 Round 2 - Senior Division
The IMF (Impossible Mission Force) has dispatched their best agent,
Ethan Hunt, to recover a recently stolen microchip. This microchip
contains critical Canadian governmental secrets, such as the Prime
Minister's favourite colour, and must be recovered before its captors
have time to download its data!
Ethan has tracked the microchip down to an underground base in
Saskatchewan. Upon infiltrating it, he's found himself in the middle of
a gigantic, square room. When viewed from above, the room can be
represented as a square on a 2D plane, with its bottom-left corner at
coordinates
and its top-right corner at coordinates
. Ethan has lowered himself down into the room, and is
standing at coordinates
(
).
There are
vertical lasers extending across
the entire room, the
-th of which is a line segment from coordinates
to
(
). There
are also
(
) horizontal lasers extending across
the entire room, the
-th of which is a line segment from coordinates
to
(
). All
vertical lasers have distinct
values, all horizontal lasers have
distinct
values, and no laser goes directly through Ethan's location
(in other words, no
value is equal to
, and no
value is equal
to
).
Ethan was hoping to simply find the stolen microchip, but he's been
greeted by a more troubling sight: there are
(
)
microchips strewn about the room! The
-th microchip is at coordinates
(
). No two microchips are
at the same location, no microchip is at Ethan's location, and no laser
goes directly through any microchip's location.
One of these
microchips must be the real one, with the rest being
decoys, but they all look identical! Unfortunately, Ethan will only have
time to go grab at most one of them before getting out of there. To make
matters even worse, Ethan may not pass through any lasers on his way to
pick up the microchip of his choice, as they'd trigger an alarm. He'll
need to weigh his options and choose his plan of action carefully!
For each microchip, determine whether or not Ethan would be able to
reach its location from
by following any continuous
path on the
plane (not necessarily a straight line segment), without
leaving the confines of the room and without passing through any of the
lasers.
Subtasks
In test cases worth
of the points, each integer in the input is no
greater than
.
In test cases worth another
of the points,
,
,
and
.
Input Specification
The first line of input consists of two space-separated integers,
and
.
The next line consists of three space-separated integers,
,
, and
.
lines follow, the
-th of which consists of a single integer,
, for
.
lines follow, the
-th of which consists of a single integer,
, for
.
lines follow, the
-th of which consists of two space-separated
integers,
and
, for
.
Output Specification
Output
lines with a single character per line, either Y
if Ethan
would be able to reach the
-th microchip, or N
otherwise, for
.
Sample Input
Copy
2 6
2 3 5
3
8
4
2
7
6 6
1 5
4 1
2 8
2 5
Sample Output
Copy
N
Y
N
N
Y
Sample Explanation
The room is illustrated below, with lasers indicated in red, Ethan's
location in green, and the microchips in blue. Note that most of the
x-coordinates and y-coordinates on the plane (from around
to around
) have been collapsed together.
Ethan would only be able to reach the
nd or
th microchip.
Comments