-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArmyStrengthHard.java
57 lines (48 loc) · 1.17 KB
/
ArmyStrengthHard.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import java.util.*;
import java.io.*;
public class ArmyStrengthHard{
public static void main(String[] args) throws IOException{
Reader read = new InputStreamReader(System.in);
BufferedReader ob = new BufferedReader(read);
String data = "'";
data = ob.readLine();
int num_cases = Integer.parseInt(data);
for(int i = 0 ; i<num_cases; i++){
data = ob.readLine();
int n = Integer.parseInt(data);
data = ob.readLine();
int m = Integer.parseInt(data);
int[] arr1 = new int[n];
int[] arr2= new int[m];
for(int j = 0 ; j<n ; j++){
data = ob.readLine();
arr1[j] = Integer.parseInt(data);
}
for(int j = 0; j<m ; j++){
data = ob.readLine();
arr2[j] = Integer.parseInt(data);
}
int high1 = arr1[0];
int high2 = arr2[0];
for(int j=1 ; j<n ; j++){
if(arr1[j]>high1){
high1 = arr1[j];
}
}
for(int j=1; j<m; j++){
if(arr2[j]>high2){
high2 = arr2[j];
}
}
if(high1 >= high2){
System.out.println("Godzilla");
}
else if(high1<high2){
System.out.println("MechaGodzilla");
}
else{
System.out.println("uncertain");
}
}
}
}