What is wrong with the code for the given problem (Link)?

Here is the link of the question Boredom (Div 1)
and here is my implementation Ideone Link
Can you please spot the error? It is a very short code. Thanks :slight_smile:

Your code is accepted now.

Check my submission. Just did slight modification in your code.

Actually you are using int and i*cnt[i]+arr[i-2] can exceed range of int so just replace int with long long and get Accepted.

1 Like

Oh, silly me. Thanks @inovation123 :slight_smile: