Problem E
Eccentric Excursion
Eddy is planning a cross-country trip across
Eddy wants to plan a trip so that he visits each city
exactly once. He may start or end at any city. It might not be
possible to visit each city exactly once using only roads.
Luckily, Eddy can take a flight between any two cities that
aren’t directly connected by a road. Eddy would like to take
exactly
Help Eddy plan his trip.
Input
The first line contains two integers
The next
Output
Output
Sample Input 1 | Sample Output 1 |
---|---|
4 1 1 2 1 3 1 4 |
2 1 3 4 |
Sample Input 2 | Sample Output 2 |
---|---|
4 0 1 2 1 3 1 4 |
-1 |