# Help me in solving TLG problem

### My issue

I don’t whats the problem in this code. Why its showing wrong answer while it runs success fully but not passing some cases.

### My code

``````/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
int i=0;
int []T=new int[n];
int [] S=new int[n];
int diff=0;
int max=0;
while((n--)!=0)
{
if(T[i]>S[i])
diff=T[i]-S[i];
else
diff=S[i]-T[i];
if(Math.abs(diff)>Math.abs(max))
}
if(max>0) //if current lead if greater than maximum lead .means the mamximum lead would be change . winner would also be updated.

System.out.print(1+" "+(max));
else
System.out.print(2+" "+Math.abs(max));

}
}

``````

Problem Link: TLG Problem - CodeChef

@vishu_2650

in my code i am checking the greatest difference in the game and keep updating it in a variable if i find any bigger difference and then i check if the value of difference is positive or negative which decides whether the winner is player 1 or 2

here is my code below
hope this helps!!

#include<bits/stdc++.h>
include
using namespace std;

int main() {
int n;
cin>>n;
int a[n],b[n];

``````for(int i=0;i<n;i++)
{
cin>>a[i]>>b[i];
}
for(int i=0;i<n;i++)
{