Overview
The total difficulty of completing cf: 2000 + 2300 + 2000 + 2300 + 1200 + 2000 + 2800 + 2400 + 1800 + 2200 = 21000 2000+2300+2000+2300+1200+2000+2800+2400+1800+2200=210002000+2300+2000+2300+1200+2000+2800+2400+1800+2200=21000
Be wyq ≈ 20000 ≈ 20000≈2 0 0 0 0 Hanging
Brief solution
CF920F
Simple ds problem, the method is similar to the square root of the interval. There are no more operations for each number. So we maintain the interval sum and interval max \maxmax . If the intervalmax ≤ 2 \max\leq 2max≤2 Then there is no need to modify it. And we only needO (x ln x) O(x\ln x)O(xlnx ) preprocessingd (x) d(x)D ( X ) can
CF785D
First, we consider for each (
separately calculate the contribution, consider this before nnn th(
behindmmm a)
, then for this(
contribution is,Σ i = 1 min (nC_{n-1}^{i-1}\times C_{m}^{i}i=1∑min ( n , m )Cn−1i−1×Cmi. Then by looking at the solution, we know that this is equivalent to C n + m − 1 n C_{n+m-1}^{n}Cn+m−1n。
CF353D
The idea of this topic is similar to CF622E. We consider setting fi f_ifiIndicates to the iii Individuals need to exchange at least several times (before guaranteeiii operations have been arranged and completed). Thenfi = max (fi − 1 + [i − la ≤ gs − 1], i − gs) f_i=\max(f_{i-1}+[i-la\leq gs-1],i-gs )fi=max(fi−1+[i−l to≤gs−1],i−g s ) , wherela laL A represents the lastF
to appear,GS GSG S represents the currentlyF
number. Time complexityO (n) O(n)O ( n )
CF79D
This topic is quite easy to write after thinking about it. We consider XOR difference, assuming nnn state of a lamp is1011
then as soon as the difference11101
. So suppose we flip[l, r] [l, r][l,r ] This interval is equivalent tocfl cf_{l} of thedifference arraycflSum cfr + 1 cf_ {r + 1}cfr+1 Just go and flip.
Differential array 1
number of affirmative ≤ 20 \ leq 20≤2 0 . So we consider state pressure dp. Letfi f_ifiIndicates arrival status iiMinimum number of operations of i , stateiii if thejjj bit is1 11 is equivalent to puttingjjThe minimum number of times j lights are turned on. The transfer is simplefi = min A ∈ i, B ∈ i (fi ⊕ A ⊕ B + g A, B) f_(i)=\min\limits_(A∈i,B∈i)(f_(i\oplus A\oplus B}+g_{A,B})fi=A∈i,B∈ime(fi⊕A⊕B+gA,B), g i , j g_{i,j} gi,jRepresents [i, j] [i,j][i,j ] interval excepti, ji, ji,j The minimum number of times that the state changes and the rest does not change state. This can be preprocessed with bfs.
CF1369E
We consider everyone to choose all, if there is still a food that has not been eaten, then people with this item will definitely not eat Leo. So we put the person who owns those foods to the end, make up for another dish he requested, and keep doing the same operations until there are no more dishes.
CF590C
01bfs template question, because there are only 3 kinds of countries. So we remember dk = [1/2/3], i, j d_{k=[1/2/3],i,j}dk=[1/2/3],i,jIt represents kkk country to(i, j) (i, j)(i,j ) Shortest distance. Immediatelymin i, j (d 0, i, j + d 1, i, j + d 2, i, j − 2 × [ai, j = \ min_ {i, j} (d_ {0, i) , j} + d_ {1, i, j} + d_ {2, i, j} -2 \ times [a_ {i, j} =mini,j(d0,i,j+d1,i,j+d2,i,j−2×[ai,j=.
] ) ]) ])。
01bfs General processing edge rights [0, 1] [0,1][0,1 ] bfs. Take the first element of the team each time, and put it at the head of the team if it is the same level for each operation that can be relaxed, otherwise put it at the end of the team.