Problem with question TLG

Hi guys.

Recently I was doing the TLG problem and I don’t know what mistake I am making. When I compile my program in Dev C++ i get the answer as required , even with size checks. This is my code:

#include<stdio.h>

int main()
{
    int si[10000],ti[10000],i,max,n,w[10000],win,l[10000];

    scanf("%d",&n);
    
    for(i=0;i<n;i++)
    {
       scanf("%d %d",&si[i],&ti[i]);
    }
    
    for(i=0;i<n;i++)
    {
         if(si[i]>ti[i])
         {
            l[i]=si[i]-ti[i];
            w[i]=1;
         }
         else
         {
            l[i]=ti[i]-si[i];
            w[i]=2;
         }
    }
    
    for(i=0;i<n;i++)
    {
         if(l[i+1]>l[i])
         {
              max=l[i+1];
              win=w[i+1];
         }
    }
    
    printf("%d %d",win,max);

    return 0;
}

Could anyone tell me where am I making a mistake? Thanks in advance…