Luo Gu $ P4045 \ [JSOI2009] $ password $ dp $ + $ AC $ automaton + Search

Positive Solutions: $ dp $ + $ AC $ automaton + Search

Report problem solving:

Portal $ QwQ $

First apparent to build a $ the AC $ automaton, then consider setting $ f_ {i, j, k} $ denotes the length of $ I $, now $ the AC $ Automaton $ J $ position, he has said out state number string $ k $ embodiment, the direct transfer like.

Then consider the output of the program. First, can easily fill a certain position does not exist.

Quite obvious just saying that Aung, first of all if there is a can easily fill a position, there are 26 possible. You can then exchange for this position and the position of the string, there are at least two possibilities, this time there were already at least $ 2 \ times 26 = 52 $, so you can easily fill a certain position does not exist.

Therefore, direct $ O (! N) $ burst search $ QwQ $, $ over $

Something like this child, if there are details I kick the code again $ upd $

Guess you like

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