WA in Chefs in Queue

Please explain what is wrong in my code…
My code:
https://www.codechef.com/viewsolution/31875425

Question:

You need to post your submission link.

Added submission link…

Constraint states that ai can take upto 10^6 which would cause overflow for int.
Modified int to long long & it works fine : CodeChef: Practical coding for everyone

1 Like