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

Автор AnupamRoy, история, 3 года назад, По-английски

Since left side size 1 and right side size 0 . the result should be for value '1'. that's index is 2.
the problem link https://codeforces.com/problemset/problem/1199/A

the screenshot of result

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

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Both indices are valid ,but the problem mentions choosing the earliest valid index. Why is the first index valid? Since y is 0 then nothing to care about to the right side of the chosen index. Since it's the first index so there are no elements to care about to the left side of the chosen index.