시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 0 | 0 | 0 | 0.000% |
While the people of Earth are grateful to Iron Man, Black Widow, the Hulk, and all the rest of the superheroes, the damage that their battles wreak on the cities they are protecting is severe. In the nearly 100 years of these battles, there have been many victories and losses in individual fights. When a new villain appears, it is conceded that a new battle must be fought. However, it has been decided that so many battles being re-fought is not safe or economical. For this reason, a task force has been formed to explore the use of a database of battles to predict who will win an upcoming battle, and then declare a winner before the battle takes place (with the inevitable citywide destruction that would follow) if at all possible.
The rules they have come up with are as follows:
The first line in the test data file contains the number of test cases (< 100). Each test case is specified on two lines: the first line starts with the number of combatants (< 100), the number of previous battles (< 1000), and then information about the previous battles as triples: “Combatant1 Combatant2 CostOfVictory”; the second line has the new battle’s combatants as: “Combatant1 Combatant2”.
For each test case, you are to output the name of the winner of the new battle, or the word “FIGHT!” if the two will need to actually do battle. The exact form is shown below.
정확한 출력 형식은 제출에서 언어를 Java로 설정하면 확인할 수 있다.
4 3 2 Thor Loki 18 Loki Catwoman 12 Thor Catwoman 4 2 Thor Loki 18 Loki Catwoman 12 Thor Firefly 3 3 Thor Loki 1 Loki Catwoman 1 Catwoman Thor 2 Thor Catwoman 3 3 Thor Loki 1 Loki Catwoman 1 Catwoman Thor 1 Thor Catwoman
Thor FIGHT! FIGHT! Catwoman