PRACTICE > EASY > THE LEAD GAME

Can someone please point out the error with my code?

#include<stdio.h>

int main ()
{ int i,max=0,win,flag=0;
long int n;

scanf("%ld",&n);

int p1[n],p2[n];

if(n<=10000)
{
for(i=0;i<n;i++)
{
scanf("%d %d",&p1[i],&p2[i]);
}

    for(i=0;i<n;i++)
    {
        if(p1[i]>p2[i]&&(p1[i]-p2[i])>max)
        {
            max=p1[i]-p2[i];
            win=1;
        }

        if(p2[i]>p1[i]&&(p2[i]-p1[i])>max)
        {
            max=p2[i]-p1[i];
            win=2;
        }

    }

    printf("%d %d",win,max);
       }


 return 0;

}

@devesh_xennom you are not adding the score after each round plz… again read the table given in question carefully and u wil get it…