0825-CSP confidence game

As we all know: CSP is an abbreviation spend pay the cost(escape)


A modern art

Enumeration of the left and right upper and lower limits of each cover an area of + second order difference
is seeking area covered by a number prefix and a rear == 1, a plurality of digital coverage area is evaluated prefix and> = 1
and did not expect an examination room of each enumeration the up and down limit coverage (in fact, I did not expect second-order differential)
was enumerated types, but think of how statistical coverage, then hastily called incorrect solution took 30 minutes slipped


B [JLOI2012] Tree

L + doubling enumeration can jump

fa[x][i]=fa[fa[x][i-1]][i-1];
dis[x][i]=dis[x][i-1]+dis[fa[x][i-1]][i-1];
len = L;
for(int i = 20; i >= 0; i --)
    if(dis[x][i]<=len){
        len-=dis[x][i];
        x=fa[x][i]; 
    }

Since data on the test pan, \ (10 ^ 5 \) data to the surface title \ (10 ^ 3 \) , much thought, the DFS + dfs order contribution (dis array) mixed 90 minutes


C Inn

Multiplying
f [i] [j]: indicates the point of departure from a number i, go \ (2 ^ j \) days, to reach the farthest store number
k = upper_bound (x + 1, x + n + 1, xi + L) the -X--. 1;
F [I] [0] = K; (and then you push out f [i] [j] the qwq)
f [i] [j] = F [F [I] [J -1]] [j-1] ;

[L,R]
for(j = 30;j;j--){
    if(R>=f[L][j]){
        L=f[L][j];
        Ans++;
    }
}

How much time left, hastily called lower_bound violence mixed with 50 points


Total Score: 30 + 90 + 50 = 170
(probably still a little progress bar orzorz, mainly the exam have not committed anything wrong with intellectual disabilities orzorzorz (oh A title \ (4 ^ 2 \) somehow into the whole \ (4 * 2 \) count qwq))

Guess you like

Origin www.cnblogs.com/qwqq/p/11407996.html