Noob here, what's wrong with my code? (TLG)

Can anyone tell me what’s wrong with my solution CodeChef: Practical coding for everyone to the problem TLG Problem - CodeChef?

@ssjgz Might help you out :slight_smile:

3 Likes

:slight_smile:

It fails on the testcase:

4
17 33
26 60
34 32
27 22

(the answer should be

2 50
)

Edit:

See my answer here.

5 Likes

Oh! i understood the question wrongly. I fixed it and now it works with your test case too but for some reason it is still not accepted.
https://www.codechef.com/viewsolution/28458850

1 Like

It seems to fail on the following testcase:

http://vps2.etotheipiplusone.com:30176/public_html/codechef/the-lead-game-failed-testcase-28458850.txt

(the answer should be

2 435084
)

1 Like

Yeah it works now. Thanks! :+1: I changed all the short ints to ints. I should be more careful with these things.

1 Like

Why it should be 2 50 …?
maybe i misinterpreted the question

Its largest cumulative lead. You need to find the sum of scores till that point and find the max difference.

1 Like