Problem E
She Talks to Angel
Fluttershy’s relationship with her pet bunny Angel has hit the skids. Zecora has brewed a solution—literally—that will help them solve their problem and understand each other better.
![\includegraphics[width=0.4\textwidth ]{TBO_FlutterAngel.png}](/problems/shetalkstoangel/file/statement/en/img-0001.png)
Zecora realized that the problem is each one’s lack of appreciation for the difficulties faced by the other, and so she concocted a body-swapping potion with a spell that will let them live a day in each other’s horseshoes.
Fluttershy and Angel, in each other’s bodies, must complete all the chores in the Sweet Feather Sanctuary. Only after completing all the chores, and experiencing the burdens carried by each other, will the lesson be learned and the spell be lifted.
Sweet Feather Sanctuary is a network of
There are
Sweet Feather Sanctuary is very large, and compared to the
amount of time it takes to get around, the time it takes to
actually do the chores is negligible. Hence, assume for
simplicity that it takes zero time to do a chore. On the other
hoof, or paw, Fluttershy travels at the speed of
Fluttershy and Angel begin at the central square at the
junction labeled
Fluttershy and Angel are eager to finish the chores as fast as possible and return to their original bodies. How should they split the chores between themselves such that if they both took the optimal route, they would finish the chores and return to the central square as fast as possible? Note that if one of them has finished and arrived at the central square before the other, she or he will have to wait.
Input
The first line of input contains four integers,
The next line of input contains
The next
It is guaranteed that from any junction it is possible to reach any other junction by treading a series of one or more paths.
Output
On the first line, output two integers
On the second line, output
On the third line, output
All
If there are multiple correct answers, you can output any of them.
Sample Input 1 | Sample Output 1 |
---|---|
7 4 7 2 3 4 6 7 1 2 1 3 1 4 1 5 5 6 5 7 |
3 1 1 3 4 2 |
Sample Input 2 | Sample Output 2 |
---|---|
10 9 7 2 2 3 4 5 6 7 8 9 10 1 2 1 4 2 3 4 5 5 6 6 7 7 8 8 9 9 10 |
7 2 3 4 5 6 7 8 9 1 2 |
Sample Input 3 | Sample Output 3 |
---|---|
4 4 1 1 2 2 3 4 1 2 2 3 1 4 |
2 2 1 3 2 4 |