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

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

I am stuck at this problem currently.

Problem link

I have tried a O(n^2) approach but the accepted solution is supposedly O(log(n)*n) or less. How do solve this?

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

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

Why not just link the problem instead of copy-pasting the statement?

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

This problem seems like this problem: https://atcoder.jp/contests/dp/tasks/dp_z

You can solve this problem using a Li-Chao tree.