Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

The lead game : what is wrong with my code?

$
0
0

The code chef compiler is giving wrong answer to this code....but is working fine on my PC :/

http://www.codechef.com/viewsolution/3611816

#include<stdio.h>
int main()
{
    int r,i,min=0,max=0,a[10000],b[10000],c[10000];
    scanf("%d",&r);
    for(i=0;i<r;i++)
    {
        scanf("%d%d",&a[i],&b[i]);
        c[i]=a[i]-b[i];
        if(c[i]<min)
            min=c[i];
        if(c[i]>max)
            max=c[i];

    }
    if(min*-1>max)
        printf("2 %d",min*-1);
    else
        printf("1 %d",max);

    return 0;

}

Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>