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

Автор bhikkhu, история, 10 лет назад, По-английски

http://codeforces.me/contest/439/problem/D

Ternary search can only be used on strictly increasing or decreasing sequence.

But, I think the problem is special in the sense that the search space is strictly decreasing first then some equal values and then strictly increasing.

Thus, ternary search can be used here. But I need to prove that if two f(p) == f(p + 1), then the value must be the answer (if f(p) == f(p + 1), f(p) = our_answer to the problem, in case f(p) = f(p + 1) for any p).

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

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

anybody please help?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What is your problem? If f(p) == f(p+1) then it is neither on decreasing part nor on increasing.

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

This had me wondering for a long time too actually. Is it possible to apply ternary search if the function isn't "strictly" convex/concave?