Can someone please help me out? I cannot understand why my solution is giving WA. It passes all the sample cases. Where is the flaw?
Question Link : Contest Page | CodeChef
My solution : Solution: 54435899 | CodeChef
Edit 1 : After @aryanc403 pointed it out, I realized the solution fails for
So, I fixed it, but I’m still getting WA. :-((
Here’s the updated solution : Solution: 54446804 | CodeChef
Any ideas would be most helpful! Thank you.
Edit 2: Solved! Turns out the if-statement had to be bracketed. Learnt a big lesson today - never mess with syntax… Its much safer to write properly bracketed and indented code. Cost me a lot in yesterday’s contest.
Thanks a lot guys!
Here is the correct solution : Solution: 54448138 | CodeChef
Moral of the story : Never mess with syntax …