Wrong answer for The Lead Game (Problem Code: TLG)

Could anyone take a look at the below code and tell me where I could be going wrong?
I really want to understand before I take a look at the editorial.
Thanks in advance!

Link to solution:
https://www.codechef.com/viewsolution/30554563

2 Likes

Please just post a link to your submission - screenshots are hard to debug :slight_smile:

Will keep that in mind, edited the post
Thanks :slight_smile:

1 Like

It seems to be the same mistake nearly everyone makes :slight_smile:

See e.g. Noob here, what's wrong with my code? (TLG) - #3 by ssjgz

4 Likes

To be honest, I think it’s one of the rites of passage here :rofl:
When I read this problem first, I made the same mistake of not looking at cumulative scores :slight_smile:

2 Likes

Yeah same :joy:

Is there a way of finding out what test cases are failing or is it just trial and error?

Since you’re starting out, here are a few things to know :slight_smile:
Codechef does not provide test cases as (I think) it would make the whole job easier of arriving at the solution and lessen the fun of getting the AC all on your own so even though you get a WA, read the question again to understand, test for corner cases, out of bounds and think of a solution that passes the time limit
Whenever you ask for help, along with a coherent description of your concern, add your code enclosed in three backticks (```) !
And keep practising, have fun and compete in contests, yay!

2 Likes

I got a correct submit.

https://www.codechef.com/viewsolution/64585986
hi experts , please help me with my code I am getting one single subtask WA , thanks in advance !

Check the following update to your code.

Accepted

The following is another possible update.

Accepted

Your code fails when one of the two players wins all the N rounds. In this case, one of the two lists xlead or ylead is empty. Using the max function to find the maximum item in an empty list should have produced a run-time error. However, as you are using try to bypass any run-time error, the Python interpreter ended your program silently without executing any print function call.