Mike is sick of the infamous RoboThieves who are always stealing treasure from him! So, he has set out on a mission to destroy all of the devious robots.
There are RoboThieves hiding in distinct positions on a 2-D cartesian plane, and Mike plans on using his special EMP device to disable them. Mike's device only has enough power to disable robots, although he can disable any combination of robots regardless of their positions. Luckily for him, the remaining enabled robots can still be taken down via a strange mechanism.
Mike has discovered that the remaining robots have set up connections with each other. Through network , each enabled robot is connected to itself and its two closest enabled robots in terms of Euclidean distance. Through network , each enabled robot is connected to itself and its two closest enabled robots in terms of Manhattan distance. If there are ties in distances, then robots with lower indices are selected preferentially. Note that connections are one-way and direct; each robot is connected to exactly three robots in each network.
Furthermore, Mike has discovered that there is a special switch on each robot. For each enabled robot, Mike is able to travel to that robot and toggle its switch on or off. All of the remaining robots will become disabled if and only if each enabled robot is connected to exactly one robot that has its switch toggled on through network and at least one robot that has its switch toggled off through network .
Can you help Mike find a way to disable all of the RoboThieves, or report that it is impossible to do so?
Note that for two points and , the Euclidean distance between them is and the Manhattan distance between them is .
Constraints
For this problem, you will NOT be required to pass ANY of the samples in order to receive points.
All points are distinct.
Subtask 1 [10%]
All and are generated uniformly at random.
Subtask 2 [20%]
Subtask 3 [30%]
All points are on the boundary of the convex hull of all points.
Subtask 4 [40%]
No additional constraints.
Note that all previous subtasks must be passed for this subtask to be evaluated.
Input Specification
The first line contains two integers, and .
The next lines contain two integers and , the coordinate location of the -th RoboThief's hiding spot.
Output Specification
If no solution exists, output -1
on a single line.
Otherwise, on a single line, output space-separated characters where the -th character denotes the state of the -th robot. Exactly characters should be X
, denoting that the robot has been disabled initially. Each remaining character should either be 0
to denote that the robot's switch is turned off or 1
to denote that the robot's switch is turned on. The configuration should disable all robots.
If there are multiple possible outputs, you may output any of them.
Sample Cases Note
Please note that the sample cases do not satisfy all of the constraints and are only provided to clarify the problem. Specifically, in the sample cases. They will not appear in any of the test cases.
Sample Input 1
10 5
-3 -2
-3 4
3 2
2 3
-4 -4
1 1
2 -3
-5 2
2 1
4 -2
Sample Output 1
0 X 0 X X 0 1 1 X X
Explanation for Sample Output 1
After disabling robot , , , , and , Mike can choose to toggle the switch on robot and . Below is a diagram of the situation with network shown. Robots that were initially disabled are marked in gray, robots with their switch turned off are marked in red, and robots with their switch turned on are marked in green. Keep in mind that each enabled robot is also connected to itself for both networks.
Then, a diagram of the same situation with network shown.
Notice that each remaining robot is connected to exactly one robot with its switch turned on in network and at least one robot with its switch turned off in network . So, this is a valid way to disable all of the robots.
Sample Input 2
15 6
4 -4
3 0
-1 -3
1 4
2 -2
3 -4
-1 2
2 3
-2 -4
-3 4
0 0
-4 1
-2 1
-5 -2
4 4
Sample Output 2
X 0 0 X 0 X 0 X X X 1 X 0 X X
Explanation for Sample Output 2
After disabling robot , , , , , , , , and , Mike can choose to only toggle the switch on robot . Again, a diagram of the situation with network is shown below.
Then, a diagram of the same situation with network shown.
Again, each remaining robot is connected to exactly one robot with its switch turned on in network , and at least one robot with its switch turned off in network . So, this is a valid way to disable all of the robots.
Comments