No more complete
Primer
This article is a study in accordance with the Lie teacher learning segment tree ppt record and some experience
cf145E
The meaning of problems
Two operations:
1. Turn \ ([l, r] \ ) of 0 and 1
2. demand \ ([l, r] \ ) of the longest sequence length is not reduced sub
Thinking
00,01,10,11 length of segment tree maintenance, flipping is the exchange (00,11) and (01,10)
The answer is max (00-00,00-01,00-11,01-11,11-11 )
Code
Code
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
BZOJ1103
The meaning of problems
A tree, each edge is initially 1, two operations:
1. 0 to a side
2. Q a point to the right side and the roots
Thinking
A law
Dfs segment tree maintenance procedures, operating range of 1 to modify, operate as a single point of inquiry 2
this question time 10s, plus a quick read run 9s. .
Code
Code
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
Act II
Euler construction sequence, the value 1 into the weight, the weight value of -1 exit
operations 1 to modify the entry and exit of the weight value of 0
operation to query prefix 2 and
Fenwick tree can
run 5s
Code
Code
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
Code