You are not logged in. Please login at www.codechef.com to post your questions!

×

# TLG: Getting wa

 0 My code is int main() { int n,s1,s2,p,i,temp_p; int lead,max_lead=0; scanf("%d",&n); for(i=0;is2) { lead=s1-s2; temp_p=1; } else { lead=s2-s1; temp_p=2; } if(lead>max_lead) { max_lead=lead; p=temp_p; } } printf("%d %d",p,max_lead); return 0; }  It works fine in my compiler for the sample input given in problem but shows "Wrong Answer" here. asked 25 Mar '12, 21:48 289●7●12●18 accept rate: 22% 0★admin ♦♦ 19.8k●350●498●541 you are getting WA since your submission is not passing the test cases. sample test cases in problem statement are only for explanatory purpose and they are not the test cases that a judge runs to validate your submission. (29 Mar '12, 15:22) can you point out as to where the code may be wrong.... (30 Mar '12, 00:32)

 4 In his version, at the end of each round the leader and her current lead are calculated. Once all the rounds are over the player who had the maximum lead at the end of any round in the game is declared the winner.  Actually, the problem statement is not quite clear about the way the lead has to be calculated. But in fact, you have to consider the cumulated lead over each turn, not the lead for each turn. The sample test case given is kinda misleading because of that. You just have to change your formula to compute the lead value. Good luck ! PS: the problem code is not INTEST as you wrote it in the title, it's TLG. answered 27 Mar '12, 01:34 3.4k●2●19●55 accept rate: 20%
 toggle preview community wiki:
Preview

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

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:

×1,070
×62

question asked: 25 Mar '12, 21:48

question was seen: 1,535 times

last updated: 15 Feb '18, 22:32