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

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

Hello,

I tried to solve BOI 2017 strings, but I got 40/100. I do not pass subtasks 1, 2, 5, so there must be some bug in the second modification query, which is to reverse a substring of the string. I tried to debug it, but I could not find the error. Any help would be appriciated. Here is my code.

Thanks

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

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

When you push the reverse lazy, you should also swap the two children (t->l, t->r).

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

On lines 36 and 40, where you swap the hashes of the children, you must not check if the children are to be reversed, so remove the if(t->l->rev), if(t->r->rev).