TLG:Even after spending half an hour on the statement and then sorting my code as the need still WA ?

,

my code is as:

#include <iostream>
#include "stdio.h"

using namespace std ;
int main()
{    int test,x,y,z,w,lead,max=0;

    cin>>test;
    if (test>10000)
        return 0;

    while(test--)
    {
        int sc1=0 ,sc2=0 ;
        cin>> x >> y ;
        if ((x<0)||(x>1000)|| (y<0)||(y>1000))
            return(0);
        sc1+=x; sc2+=y;
        if(sc1>sc2)
            {
            w=1;lead=sc1-sc2;
            }
        else
           if ( sc2>sc1)
            {
            w=2; lead=sc2-sc1;
            }
        
    
         if(lead>max)
         {
             max=lead;
             z=w;
         }

        }
        cout<<z<<" "<<max;
     return (0);
}

Afterreading a lot of comments I realised sum of scores was to be done. But still its wrong answe.
Any help would be appreciated !

Here, is the correct


[1]. Hope, you figure out your mistake.


  [1]: http://ideone.com/GBXH58
1 Like

@navkiran mahajan one more thing, you need not to check the constraints. Since, over codechef test cases are of high quality(most of the times 99%) and strictly lie with in the constraints.

@sobhagya I think it would be nicer if you told him what was the problem with his code so he could write it himself even if it’s only a single statement… It’s just my opinion, I think submitting a code that you edited yourself feels better and helps retain the things you learn… Once again I’m not in any way telling your answer is bad, just that it could perhaps be improved…

1 Like

@junior94 In this case there is not much to tell. That’s why i let @navkiran mahajan to figure out his mistake.

1 Like