Fat brother and Maze are playing a kind of special (hentai) game in the clearly blue sky which we can just consider as a kind of two-dimensional(二维的) plane. Then Fat brother starts to draw N starts in the sky which we can just consider each as a poin…
Huffman分治的NTT,常数一般.使用的时候把多项式的系数们放进vector里面,然后调用solve就可以得到它们的乘积.注意这里默认最大长度是1e6,可能需要改变. #include<bits/stdc++.h> using namespace std; typedef long long ll; int a[200005], b[200005], btop; const int MAXN = 1e6, MAXLOGN = 20, mod = 998244353; int add_mod…
题面 一根长为 n 的无色纸条,每个位置依次编号为 1,2,3,-,n ,m 次操作,第 i 次操作把纸条的一段区间 [l,r] (l <= r , l,r ∈ {1,2,3,-,n})涂成颜色 i ,最后一定要把纸条涂满颜色,问最终的纸条有多少种可能的模样. 输入为两个数 n,m ,输出为你的答案 m <= n <= 1e6 题解 不考虑先前染的颜色被覆盖这件事情.如果某种颜色在最终的序列中出现了 x 次,那么我们就直接认为在染这种颜色的时候,我们只染了 x 个格子. 但这样一来每次染…
Problem Description Let f(x) = anxn +...+ a1x +a0, in which ai (0 <= i <= n) are all known integers. We call f(x) 0 (mod m) congruence equation. If m is a composite, we can factor m into powers of primes and solve every such single equation after wh…