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
When you push the reverse lazy, you should also swap the two children (t->l, t->r).
Hey :P I think I do that in line 33.
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).
Thank you very much!!!! 100/100 now.
Also another way is to have two functions — one for pushing lazy and another for pushing up the values of the children. This way it's less confusing. I modified your code for that here. "operation" is the push up function and the "upd" is the push down.
PS: it also passes for 100.
Oh nice. Thanks a lot! Indeed it's less confusing.