Here is the problem:- http://www.spoj.com/problems/ARMY/
public class Main
{
public static void main(String[] args) throws java.lang.Exception
{
Scanner s=new Scanner(System.in);
int t=s.nextInt();
while(t>0)
{
int max1=-1;
int max2=-1;
s.nextLine();
int ng=s.nextInt();
int nm=s.nextInt();
for(int i=0;i<ng;i++)
{int x=s.nextInt(); if(max1<x) max1=x;}
for(int i=0;i<nm;i++)
{int x=s.nextInt(); if(max2<x) max2=x;}
if(max1>=max2) System.out.println("Godzilla");
else System.out.println("MechaGodzilla");
t--;
}
}
}
Can someone please tell me why am I getting TLE?