×

# TLG:code gives correct output still ans is wrong plz help me find whats wrong in program

 0 link text Above lies the link to problem statement. I'm providing the code below, kindly help me. Thank you... #include int main() { int N=0,i=0,W=0,L=0,s=0,t=0; scanf("%d",&N); int mS=0,mT=0; int Si[N],Ti[N],maxS[N],maxT[N]; for(i=0;iTi[i]) { maxS[i]=Si[i]-Ti[i]; if(i==0) mS=maxS[i]; if(i!=0 && maxS[i]>maxS[i-1]) mS=maxS[i]; } else { maxT[i]=Ti[i]-Si[i]; if(i==0) mT=maxT[i]; if(i!=0 && maxT[i]>maxT[i-1]) mT=maxT[i]; } } if(mS>mT) { W=1;L=mS;} else { W=2;L=mT;} printf("%d %d",W,L); }  asked 10 Aug, 23:21 2★anuj_it 16 accept rate: 100%

 0 These two lines are wrong: if(i!=0 && maxS[i]>maxS[i-1]) if(i!=0 && maxT[i]>maxT[i-1])  ... you need to compare to more than the immediately previous result. answered 11 Aug, 01:12 5★joffan 903●8 accept rate: 12%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags: