NOIP analog 8

T1

Water problem, but not A, ashamed.

It is worth mentioning that, although I forgot kmp, manufacturing site because of the lack of kmp special sentenced to hang for the subject, but kmp board manufacturing site can string the board had questions ..

On the board .. modification ... and change the way!

1 nx[0]=-1;
2 for(int i=2,j=-1;i<=len;++i){
3     while(~j&&ch[j+1]!=ch[i]) j=nx[j];
4     nx[i]=++j;
5 }
View Code

 

 

T2

It is also more water, but not A, ashamed.

Initialization time made a clear mistake low, dead. Changed, A a.

Record a show operation, carefully taste found it very clever

for (Register int I = fr [X]; I; I = Mo [I] .pr) 
    { 
        Register int Y = Mo [I] .to;
         IF (! DFN [Y]) 
        { 
            Tarjan (Y); 
            Low [ X] = min (Low [X], Low [Y]);
             IF (Low [Y]> = DFN [X] && DFN [Y] <= DFN [n]) // latter condition ensures that only n of ancestors triggered at 
            { 
                Son ++ ;
                 IF (! = X . 1 || Son> . 1 ) Cut [X] = . 1 ; 
            } 
        } 
        the else Low [X] =min(low[x],dfn[y]);
    }
View Code

 

T3

Do very painful, very painful reform, because the solution can not read the title, I had to. .

Independent research proves: Premise: abstract sequence is 01, enumeration breakpoints converted into sequences, each sequence can be at both ends of the 1 moved to ensure that the answer does not leak

       Consider each 1, it moved to the left at a consideration of the number of zeros to the left, the right price for the right number 0

       The past more than 0 to less inferior to the direction to go in the direction to go

       1 a, which side it is more than 0, the sequence is monotone

       So let them go to the left little to the left of 0, and the rest go to the right

       0 is the number of boundary point (the middle of two between even is 0, the intermediate odd is 0)

Each breakpoint, O (1) solving complexity of O (N)

Guess you like

Origin www.cnblogs.com/yxsplayxs/p/11246029.html