Death Gun is wreaking havoc in the world of SAO::J, and must be stopped! As the protagonist, it is your duty to hunt him down and prevent any more innocent gamers from being logged off! However, Death Gun is adept at hiding and has disguised himself as one of the users in the judge! You know that Death Gun, whoever he/she is, has an extensive information network, and some certain people may know their identity. You have obtained this information network from the admins of SAO::J, in the form of a list with
Note: A person may have several different people they want you to visit first.
Input Specification
Line 1: 1 integer
Next
Output Specification
On each line
Sample Input
3
Fataleagle Quantum
Quantum Xyene
Xyene DefinitelyNotDeathGun
Sample Output
DefinitelyNotDeathGun
Xyene
Quantum
Fataleagle
Explanation for Sample
If you go to Fataleagle, he will redirect you to Quantum, who will redirect you to Xyene, who will redirect you to DefinitelyNotDeathGun. Therefore you should visit DefinitelyNotDeathGun first, then Xyene since you've already visited DefinitelyNotDeathGun, Quantum since you've visited Xyene, and then Fataleagle since you've visited Quantum.
Comments
I guess Kirito was too busy fighting Death Gun to write this problem
You should print everyone's names except for the people that are part of a loop.
I took a long time to figure this out.
Lol I know a bunch of the people you used for test cases. They go to my school
This was especially confusing to understand. Could anyone help me out?
(or someone who is someone who wants you to visit someone that you don't want to visit due to loops, or etc.)
edges are not bidirectional, don't output cycles :)
Hey all,
I was hoping for some clarification on this.
Is this trying to say that all people in a connected component with a cycle should be avoided? Or is it that if the edges were all bidirectional, all people in a connected component that has a cycle should be avoided?
So if we have
3
1 2
2 1
1 3
Should we avoid
3
?And if we have
3
1 2
2 1
3 1
Should we avoid
3
?Is it possible for one user to redirect to multiple users?
This comment is hidden due to too much negative feedback. Show it anyway.