FLIPCOIN - the definite topic for us to learn Segtrees!!

I have solved it.

Hi there, this was really a very good video. Thanks for making it.
https://www.youtube.com/results?search_query=flip+coin+codechef

There’s no segtree solution for flipcoin in python, the one I tried (iterative, algorithm from codeforces) gave TLE. Did anybody manage to get an AC in python3 using segtree or are the constraints too tight?

User @alexthelemon has a solution using BIT so I’m looking to figure that out.

A good resource for learning segment trees

1 Like
	lazy[node<<1] = 1-lazy[node<<1];
	lazy[(node<<1)+1] = 1- lazy[(node<<1)+1] ;

@grimmjowwww what are we doing by this ??

Great! Interesting how you have used the condition for lazy update → (end-start+1) - ST[node]
Is it possible for any range based problem to have a suitable condition for lazy update?

Hello,can you please help me, i am not able to spot my mistake in the code.
https://www.codechef.com/viewsolution/48669530
Thanks in advance.

I am not able to find my mistake in the code.
Can anyone please help me out.
Thanks in adavance.
https://www.codechef.com/viewsolution/48669530