Luo Gu $ P2150 \ [NOI2015] $ sushi dinner $ dp $

Correct answer: $ dp $

Report problem solving:

Portal $ QwQ $.

Failing decided to write $ dp $ ($ bushi $. Reason this question one can feel in addition to $ dp $ algorithm also can do nothing good, so consider the $ dp $ chant

Look at the part of the sub? $ 30pts $ found that the number of prime factors to consider like a thief less pressure $ dp $ get away duck.

Then now $ 100pts $, found that the number of prime factors too much on the $ GG $.

But this is clearly time to consider each count a maximum of a $ \ geq \ sqrt (n) $ prime factors.

Therefore, in order to confront factor $ \ sqrt (n) $ bounded into two categories, greater than or equal to $ \ sqrt (n) $ $ X $ prime factors enumerated directly, apparently only in multiples of $ X $ a in collection or hold, so the direct enumeration of the $ x $ each, respectively, $ dp $ recombine them enough.

Specifically, set $ f_ {i, j} $ represents a first selected individuals $ \ leq \ sqrt (n) $ prime factor set is $ I $, second option is $ J $ program number. then set $ g_ {0/1, i, j} $ $ DP $ auxiliary array, i.e. enumeration $ X $ $ X $ when recording multiple programs do not set into a second / first set of number.

Note then that each of the G $ $ $ f $ reversed when the recursive formula is $ f_ {i, j} = g_ {0, i, j} + g_ {1, i, j} -f_ {i , j} $. on, as will include two $ G $ $ X $ of all multiples is not selected, it is necessary to re-find duplicate exactly $ f_ {i, j} $, subtracting like

$over$

Guess you like

Origin www.cnblogs.com/lqsukida/p/11665023.html