Input Specification
Line
Line
Lines
It is guaranteed that it will be possible to kill all guards. There may be multiple connections between the same pair.
Output Specification
Print on the first line the minimum number of times
is required to change his weapon.Sample Input
Copy
6 4
0 1 0 1 1 1
0 1
3 2
1 2
2 5
Sample Output
Copy
3
Comments