TLG: Getting wa

import java.io.;
import java.util.
;
//import java.util.Scanner;

import java.lang.*;
class Main
{
   public static void main(String args[])throws IOException
  {
      Scanner sc = new Scanner(System.in);
     int t=sc.nextInt(); 
     int i,j,k,flag=0;
     int[] a=new int[t];
     int[] b=new int[t]; 
     int p1,p2;
      j=k=0;
     for(i=0;i<t;i++)
     {
       p1=sc.nextInt(); 
       p2=sc.nextInt(); 
        if(p1>p2)
        {
         a[j]=p1-p2;    
         j++;
        }
        else
        {
         b[k]=p2-p1;    
         k++;
        }
      }
      int max=a[0];
     for(i=0;i<j;i++)
     {
       if(a[i]>max){
       max=a[i]; flag=0;}
       for(int l=0;l<k;l++)
       {
         if(b[l]>max)
         {
             max=b[l];
             flag=1;
         }
       }      
      }
      if(flag==1)
       System.out.println("2 "+max);
      else 
        System.out.println("1 "+max);
  }
}

In his version, at the end of each round the leader and her current lead are calculated. Once all the rounds are over the player who had the maximum lead at the end of any round in the game is declared the winner.

Actually, the problem statement is not quite clear about the way the lead has to be calculated.
But in fact, you have to consider the cumulated lead over each turn, not the lead for each turn. The sample test case given is kinda misleading because of that. You just have to change your formula to compute the lead value. Good luck !

PS: already answer here : http://discuss.codechef.com/questions/236/getting-wa-for-problem-tlgthe-lead-game

you could have found it by using the proper tags of the problem. :slight_smile: see TLG

//