I am new to code chef and trying The Lead Game .I can’t figure out why my code is getting a wrong answer as it gives exactly same input output on my local machine.This is what I have written-
#include <stdio.h>
int main()
{
int N;
scanf("%d", &N);
int i;
int lma=0;
int lmb=0;
int p1;
int p2;
for (i = 1; i <= N; i++)
{
scanf("%d %d", &p1, &p2);
if (p1 > p2)
{
int t = (p1 - p2);
if (t > lma)
lma = t;
}
else
{
int t = (p2 - p1);
if (t > lmb)
lmb = t;
}
}
if (lma > lmb)
printf("%d %d\n",1,lma);
else
printf("2 %d\n",2,lmb);
return 0;
}
i’ve tried all the possible combinations that i found and all that i could think of, for this problem, and i still received a wrong answer. i don’t know what solutions to try anymore.