Submit | All submissions | Best solutions | Back to list |
ARMY - Army Strength |
The next MechaGodzilla invasion is on its way to Earth. And once again, Earth will be the battleground for an epic war.
MechaGodzilla's army consists of many nasty alien monsters, such as Space Godzilla, King Gidorah, and MechaGodzilla herself.
To stop them and defend Earth, Godzilla and her friends are preparing for the battle.
Problem specification
Each army consists of many different monsters. Each monster has a strength that can be described by a positive integer. (The larger the value, the stronger the monster.)
The war will consist of a series of battles. In each battle, the weakest of all the monsters that are still alive is killed.
If there are several weakest monsters, but all of them in the same army, one of them is killed at random. If both armies have at least one of the weakest monsters, a random weakest monster of MechaGodzilla's army is killed.
The war is over if in one of the armies all monsters are dead. The dead army lost, the other one won.
You are given the strengths of all the monsters. Find out who wins the war.
Input specification
The first line of the input file contains an integer T specifying the number of test cases. Each test case is preceded by a blank line.
Each test case starts with line containing two positive integers NG and NM – the number of monsters in Godzilla's and in MechaGodzilla's army. Two lines follow. The first one contains NG positive integers – the strengths of the monsters in Godzilla's army. Similarly, the second one contains NM positive integers – the strengths of the monsters in MechaGodzilla's army.
Output specification
For each test case, output a single line with a string that describes the outcome of the battle.
If it is sure that Godzilla's army wins, output the string "Godzilla".
If it is sure that MechaGodzilla's army wins, output the string "MechaGodzilla".
Otherwise, output the string "uncertain".
Example
input: 2 1 1 1 1 3 2 1 3 2 5 5 output: Godzilla MechaGodzilla
Hint
In the first test case, there are only two monsters, and they are equally strong. In this situation, MechaGodzilla's monster is killed and the war ends.
In the second test case, the war will consist of three battles, and in each of them one of Godzilla's monsters dies.
For all the test cases, int in C/C++/Java or longint in Pascal is enough.
Added by: | Fudan University Problem Setters |
Date: | 2008-05-24 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: C99 ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | IPSC 2008 |
hide comments
|
||||||||||||||
2016-12-27 15:48:06
"uncertain" cost me two WA. No need of uncertain. question is easy.No need of sorting.just compare max of two armies. Last edit: 2017-01-02 14:56:56 |
||||||||||||||
2016-12-11 19:10:40
compare two maximums of both armies |
||||||||||||||
2016-12-06 16:00:01
#25 |
||||||||||||||
2016-11-04 06:49:17
No uncertain cases. Problem statement is misleading . |
||||||||||||||
2016-10-29 09:51:18 E Naveen Kumar
AC in a GO..!! |
||||||||||||||
2016-10-13 15:36:49
very simple dont think too much |
||||||||||||||
2016-09-25 22:44:15
One Tip NOT related to this problem. In case you gotta output a string, like in this problem; simply copy the string from description of the problem, and paste it where you want to in your code. NEVER TYPE THAT STRING YOURSELF! Else you'll get wrong answers and you'd never guess why! Last edit: 2016-09-25 22:44:41 |
||||||||||||||
2016-08-23 00:30:09
AC in a GO!!! no uncertain...just think |
||||||||||||||
2016-08-21 08:39:01
got tle in java but ac in c++ with same logic... keep it simple :) Last edit: 2016-08-21 08:39:42 |
||||||||||||||
2016-07-30 19:25:57
try BufferedReader for java.:) |