Issue with the recent contest for question (Buying Candies)

My code got wa for the same question but the same answer got accepted for other user.
My code Link:https://www.codechef.com/viewsolution/38910292
Cross Check Link:https://www.codechef.com/viewsolution/38909471

Or if there is some corner case that I am missing … then help me

Overflow in your case ig. The constraints were too big for long . The other user has used long long int .

What’s wrong with mine ?
Solution - https://ideone.com/mrTL9N

probably the test cases are wrong, check this

And moreover , technically O(T*N *log(N)) solution should give TLE as T<=1000 and N<=100000. It should be a linear over the price array to find the optimal choice.

Some test case to know why this is wrong.

My code: https://www.codechef.com/viewsolution/38909144

I have tried with long long too during contest but still got wa

yeah , I also think that

It is actually the case check the codes in this thread, assertion proves it all. Test cases were wrong.

Yes , even long long int is giving WA verdict . I have no idea what exactly is going wrong.

@cubefreak777 The standing is updated. Have a look.

1 Like

I think the test cases are wrong.

Thanks a lot for such a prompt response, I sincerely appreciate it.

1 Like