Jonathan-Uy / CSES-Solutions

Accepted Solutions to the CSES Competitive Programming Problem Set
514 stars 166 forks source link

while practicing I find minor bug so is corrected it line : 12, (i<N-1) #2

Closed AnugrahYadav closed 2 years ago

AnugrahYadav commented 2 years ago

Hey !! It's Anugrah First of all thank you for such a helpful repository and there was a small bug in the code which I debugged ... while practicing

Jonathan-Uy commented 2 years ago

Hey Anugrah,

Thanks for the pull request, but I do not think your change is correct. Consider the following test case:

2
2 1

The number of moves to make the array increasing is 1, by adding to the second element. However, your modified program outputs 0. The loop should range i < N, and not i < N-1, so that we read the last element and check if it needs to be added to. I'm glad you found the repository helpful and would be happy to help with questions in the future, but try submitting to CSES first to check your solution before reporting a bug.

AnugrahYadav commented 2 years ago

Actually I submitted it first .... And then only reported the bug... check it out ..

On Wed, 9 Mar, 2022, 00:20 Jonathan Uy, @.***> wrote:

Hey Anugrah,

Thanks for the pull request, but I do not think your change is correct. Consider the following test case:

2 2 1

The number of moves to make the array increasing is 1, by adding to the second element. However, your modified program outputs 0. The loop should range i < N, and not i < N-1, so that we read the last element and check if it needs to be added to. I'm glad you found the repository helpful and would be happy to help with questions in the future, but try submitting to CSES first to check your solution before reporting a bug.

— Reply to this email directly, view it on GitHub https://github.com/Jonathan-Uy/CSES-Solutions/pull/2#issuecomment-1062095207, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQFYMOVFKJSLZE5MCHQGWO3U66OOLANCNFSM5QHED32Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>