Codeforces Round #698 Nezzar and Binary String - Segment tree

Solution

Of course a segment tree problem.

Let's start from $f$. Then actually, the state of last day is fixed. Also fixed for the day before last day. The only thing we need to know is how many zeros between $l$ to $r$. Then we can know what is changed.

For example the next state between $l$ and $r$ is $00011$. Then it must be changed from $00000$. Then change it back. And see if it match $s$.

Code

Submission #111853570 - Codeforces
Codeforces. Programming competitions and contests, programming community
DigitalOcean Referral Badge 蜀ICP备19018968号