This might sound like a cringy schoolboy going to the teacher with his classmate’s copy to get his marks deducted.
Yesterday I asked a question in this forum regarding not being able to find a mistake in my CHFRAN python code that got 90 pts in the contest but my question got no answer. Today I picked up a random contestant’s python solution, created a test file with random inputs (as per problem constraints) and compared his outputs to mine. I found that the test cases of the problem are so bad that 5 out of 20 test cases I created in the first try proved that his solution was definitely wrong. And I have still not been able to find the error in my solution (I’m not saying mine can’t be wrong, but doesn’t seem like it.)
@rishup_nitdgp: Please take a look.
My solution: https://www.codechef.com/viewsolution/28300857
I have just created partitions of the set of ranges based on overlap and keep track of the number of active (open) ranges which have not ended yet. Also keeping track of the previous_active and previous_to_previous_active values.
This helps to find the local (as well as global) minima of the active variable.
His solution: https://www.codechef.com/viewsolution/28142465
A few test cases for which his solution gives wrong answer (ideone link: https://ideone.com/2uRXmt -all 5 test cases give zero when run against his code).