Had it even been TLE/RTE instead of AC, It would have been possible that due to server load, it gave different runtime verdicts. But AC and WA cannot be explained except if the Test Cases were changed DURING THE LAST MINUTE which seems ridiculous. Hence this is sort of a bug report and also a Far Cry for help coz I had accidentally submitted that same solution in a hurry to get it submitted within time and had I only submitted the first solution, I was sure to get a much higher rank and a negative delta rating change . @admin Please look into this matter if possible
The UB was most probably due to setting high=n. Now on setting high=n-1, the code gives a complete WA, atleast earlier it was giving partial AC 30 pts. Any insights on where the bug might be. Thanks in advance.
Have you tried to debug it? It fails for the sample testcase, so you’ve got a nice, 100% reproducible testcase
As a hint: you should be getting -1 for the last two values in the sample testcase, but you are not. Maybe look at the values of a and b you’re getting, here?
Edit:
Oh - this thread’s really old, and only got bumped to the top because you fixed a typo