comgaTramAnh's blog

By comgaTramAnh, history, 2 years ago, In English

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.

  • Vote: I like it
  • -1
  • Vote: I do not like it

| Write comment?
»
2 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

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]