Блог пользователя comgaTramAnh

Автор comgaTramAnh, история, 19 месяцев назад, По-английски

Hello Codeforces,

My sister implemented the solution for 279B — Books here:

https://ideone.com/uPow6L

And so amazing !!!! This solution is accepted. I've tried but cannot create the test case to prove this solution is wrong. Can you help me ? Or can you prove that this solution is correct

Thank you a lot for your help.

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

»
19 месяцев назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

That solution is correct. It's a basic implementation of two-pointers.

At any time, if sum <= m, then [l, i] is a valid answer. From [l, i — 1], we should increase the length by one. Otherwise, we keep the current length at the same amount, from [l, i — 1] to [l + 1, i]