
There is a circuit with
A MOOSE gate computes the negation of the AND of the inputs. That is, it outputs
The gates are numbered
Each MOOSE gate's input is from two gates with smaller IDs.
At the moment, all inputs have the same value
You want to change as many of the inputs to fixed values (
Constraints
For all subtasks:
Subtask | Points | Additional Constraints |
---|---|---|
1 | 10 | |
2 | 30 | |
3 | 60 | No additional constraints. |
Input Specification
The first line of input will contain two space-separated integers,
The next line of input will contain
Output Specification
Output a single line with 0
(set to false), 1
(set to true), or x
(set to
Sample Input 1
2 1
1 2
Sample Output 1
x1
Sample Input 2
3 6
1 3 1 2 4 5 4 5 7 6 8 8
Sample Output 2
10x
Sample Input 3
4 18
1 1 2 2 5 6 1 2 7 8 9 9 3 3 4 4 11 12 3 4 13 14 15 15 10 10 16 16 17 18 10 16 19 20 21 21
Sample Output 3
0000
Comments