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

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

Hi CF community!

I was thinking about some problem:

Given a string S, in each query you must reverse some substring of it. Then, at the end you must print the string. Constraints are 1 ≤ |S|, Q ≤ 105 where Q is number of string reversals.

I'm now wondering about what is the offline and the online algorithms to solve this problem.

Thanks!

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

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

For an online algorithm try a treap (or any BBST).