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
Mike has discovered that the remaining robots have set up connections with each other. Through 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
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
Constraints
For this problem, you will NOT be required to pass ANY of the samples in order to receive points.
All
Subtask 1 [10%]
All
Subtask 2 [20%]
Subtask 3 [30%]
All
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,
The next
Output Specification
If no solution exists, output -1
on a single line.
Otherwise, on a single line, output 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
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,
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
Then, a diagram of the same situation with network
Notice that each remaining robot is connected to exactly one robot with its switch turned on in network
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
Then, a diagram of the same situation with network
Again, each remaining robot is connected to exactly one robot with its switch turned on in network
Comments