Codeforces 438E the "child" and Binary tree NTT Template generation function Application __codeforces

Source: Internet
Author: User

Ask how many binary trees make each of the point weights in the given set C and the weight values and

An FS f_s represents the number of qualified two-forked trees with a total weight of s.
So there
F0=1fs=∑w∈c∑ifixfs−w−i \begin{align} &f_0=1\\ &f_s=\sum_{w\in c}\sum_i f_i\times f_{s-w-i} \end{align}
Found the right and convolution a bit like.
So make
Gk=∑ifixfk−i g_k=\sum_i F_i\times F_{k-i}
Since G (k) =f (k) ⊗f (k) g (k) =f (k) \otimes f (k), that is, the sequence G G is the self convolution of the sequence F F (own disorderly name do not care).
It is known from convolution law that the relationship between the generating function of the sequence G and F F is: g (x) =f2 (x) g (x) =f^2 (x).

There are also fs=∑w∈cgs−w f_s=\sum_{w\in C} g_{s-w}
If the new sequence of G G to move the W bit to the right of the sequence is HW h_w, then there is f

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.