Original link: https://www.shuizilong.com/house/archives/bzoj-2863-%E6%84%A4%E6%80%92%E7%9A%84%E5%85%83%E9%A6% 96/
set up It means that there are exactly j schemes whose in-degree is 0, there are:
(1)
The complexity is O(n3), we can use the prefix and + redundancy to optimize the enumeration in the inner layer, there are:
(2)
Here, Newton’s binomial expansion is used, (1+x)^n, and x = -1 is substituted.
This article is reproduced from: https://www.shuizilong.com/house/archives/bzoj-2863-%E6%84%A4%E6%80%92%E7%9A%84%E5%85%83%E9%A6% 96/
This site is only for collection, and the copyright belongs to the original author.