Original link: https://www.shuizilong.com/house/archives/luogu-p5828-%E8%BE%B9%E5%8F%8C%E8%BF%9E%E9%80%9A%E5%9B% BE%E8%AE%A1%E6%95%B0/

Almost the same as the previous question , double experience!
#include <lastweapon/poly>
using namespace lastweapon;
Poly H, HH;
int n;
LL C2(LL n) {
return n*(n-1)/2;
}
int b(int n) {
Poly A(n); REP(i, n) A[i] = H[i] * -n;
Poly B = HH.mod(n) * A.exp();
return (B[n-1] * fac[n-1] / n).x;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
vector<int> q; DO(5) q.PB(RD()); n = *max_element(ALL(q)) + 1;
Poly C(n), G(n); REP(i, n) G[i] = Mint(2).pow(C2(i)), G[i] *= invFac[i]; C = G. log();
H = C; REP(i, n) H[i] *= i; HH = HD();
for (auto i: q) printf("%d\n", b(i));
}
This article is reproduced from: https://www.shuizilong.com/house/archives/luogu-p5828-%E8%BE%B9%E5%8F%8C%E8%BF%9E%E9%80%9A%E5%9B% BE%E8%AE%A1%E6%95%B0/
This site is only for collection, and the copyright belongs to the original author.