"UNR # 2" pre-dawn chocolate

"UNR # 2" pre-dawn chocolate

Problem-solving ideas

Consider a subset \ (S \) of the exclusive OR and if \ (0 \) then the contribution \ (2 ^ {| S |} \) , the equation is easy to list the production function, where the convolution is XOR convolution.
\ [[X ^ 0] \
prod_ {i = 1} ^ {n} (2x ^ {a_i} +1) \] Since only one each of the two \ (x ^ 0, x ^ {a_i} \) have value, denoted \ (F_i (X) = 2x + 1'd} ^ {a_i \) , \ (f'_i (X) = \ {text} Fwt F (X) \) , there are
\ [f_i '(x) = \ sum_ {S} (1 +
2 \ times (-1) ^ {| S \ cap a_i |}) x ^ S \] difficult to find \ (f'_i (x) \) each is not a \ ( 3 \) is \ (--1 \) .

This step is more subtle, taking into account the \ (\ text {Fwt} \ ) is a linear transformation, linear transformation and linear transformation equal, we have all the polynomial sum (\ \ Fwt {text}) \ , solutions can equation out how many of each item \ (3 \) and the number of \ - (1 \) configuration.

Set \ ([x ^ S] f_i (x) \) a \ (K \) th \ - (1 \) to give contribution \ (k = \ frac {3n- [x ^ S] f_i (x)} {4 } \) , then we require that all polynomials of the convolutional \ (\) \ text {Fwt } results, i.e. \ ([X ^ S] = (-. 1). 3 ^ ^ K + NK} {\) , and finally then \ (\ text {IFwt} \ ) back to.

The last fact is not required \ (\ text {IFwt} \ ) , and we simply requires \ ([x ^ 0] F (x) \) values, according to the \ (\ text {IFwt} \ ) of formula
\ [F_S = \ dfrac {1}
{2 ^ n} \ sum_ {T} (- 1) ^ {| S \ cap T |} F'_T \] so \ ([x ^ 0] F (x) \) each value is the combined coefficients except a \ (n-2 ^ \) .

summary: This revelation when we seek to make more use of point values ​​of nature, can not be caught in the routine.

code

Guess you like

Origin www.cnblogs.com/mangoyang/p/11779505.html