UOJ426. [2018] Team job stone [shaped pressure DP, min_25 sieve]

UOJ

Thinking

(The following idea is Hu mouth, but correctness is probably no problem.)

When the screen is just learning min_25 wheat boss persuaded to do this problem?

It was found that this problem is a waste combo? ?

Simple push equation can answer is this:
\ [\ sum_ {T =. 1} ^ m (F * \ MU) (T) \ SUM _ {\ {a_i \ Le m / T \}} \ prod_i [A_ { x_i} \ le a_ {y_i}
] \] wherein \ (F (n-) = (\ sigma_0 (n-^. 3)). 3 ^ \) .

Can be obtained by chiral play \ ((F * \ MU) (P ^ C) ^ = 81c + 2-27c. 9, C \ NE 0 \) , and may then be min_25 prefix request.

Now problem into: For a given upper bound, to meet the demand limit \ (\ {a_n \} \ ) has several.

First contraction point. Consider enumeration \ (\ {a_n \} \ ) different \ (A \) has several, and then shaped pressure DP: set \ (f_s \) represents the discharge from small to large, this has been put \ (S \) the number of programs. We do \ (n \) times the transfer, finished \ (i \) after the time \ (f_U \) is at most \ (i \) different \ (a \) the number of programs.

Transfer can enumerate a subset, but obviously TLE. Consider a point that can be put up if and only if it is less than all put up, so there is a transfer method according to the topological sequence:

f[0]=1;
rep(i,1,n)
{
    repd(j,n,1)
    {
        int s=((1<<n)-1)^mp[j]^(1<<j-1);
        for(int k=s; ; k=(k-1)&s)
        {
            f[k^mp[j]^(1<<j-1)]+=f[k^mp[j]];
            if(!k) break;
        }
    }
    cur[i]=f[(1<<n)-1];
}

(Michael Boss nb!)

Wherein \ (n-\) topological order maximum, \ (mp_j \) Record \ (J \) directly connected to a point.

Finally, \ (cur \) binomial inversion about gone.

Code

Gugu Gu

Guess you like

Origin www.cnblogs.com/p-b-p-b/p/11616439.html