Here only put solution to a problem, and hold the title face & Codes
So we quickly went to regular Rui krypton gold ah Then enjoy the thrill of krypton gold abused
A
Category Discussion Questions
Selected from the group comprising a first interval with a * and there is no, then the routine can follow the right end section of a row sequence, provided \ (dp [i] \) represents the selected section \ (I \) intervals maximum answers
Set interval \ (j (j <i) \) of \ ([l_j, r_j] \) , from the viewpoint \ (dp [j] \) updated to \ (dp [i] \)
\(r_j<l_j\)
It can directly update
\(l_j<l_i,r_j\leq r_i\),\(i,j\)同色
To \ ((r_j, r_i] \ ) plus \ (x \) contributions
\(l_j<l_i,r_j\leq r_i\),\(i,j\)异色
To \ ((r_j, r_i] \ ) plus \ (x \) contribution to \ ([l_i, r_j] \ ) minus \ (x + y \) contributions
What you can segment tree maintenance
B
Gugu Gu
C
One thing noted: \ (K \ GEQ F (I, J) \ GEQ F (I, J +. 1) \) , in conjunction with their own reasons please \ (F \) defined appreciated
Then with this thing, we can design dp status: \ (dp [i] [S] [the X-] \) represents from \ (i \) layer \ (s \) the starting point of the set point, delete \ (x \) points can not reach the first layers,Think of how to feed From high to low level dp
Consider that you do not delete this layer delete point:
Does not delete that \ (DP [I] [S] [X] = min (DP [I] [S] [X], DP [I +. 1] [to [S]] [X]) \) , wherein \ (to [s] \) represents \ (S \) a first set of points that can be reached \ (i + 1 \) point set point layer
Delete the words of truth you want to enumerate the subset, then \ (3 ^ k \) properly the explosion
But you find that with \ (x \) increased, \ (S \) is reduced. So small to large enumeration (x \) \ update, delete and enumerate (x \) \ which points. There \ (dp [i] [s ] [x] = min (dp [i] [s] [x], dp [i] [s / y] [x-1]) (y \ in s) \)
The boundary conditions are \ (dp [i] [s ] [x] = n + 1 \; (x <count (s)), dp [i] [s] [x] = i \; (x \ leq count ( S)) \) , where \ (count (s) \) represents \ (s \) in the number of \ (1 \)
Finally, statistical answer is \ (\ SUM (dp [i] [U] [the X-] -dp [i] [U] [the X-]) the X-* \) , where \ (U \) as the complete works, in order to facilitate \ (dp [i] [U] [x ] \) to and \ (i + 1 \) take \ (max \)