版本比较
多项式基础工业
正文
增加 6 行删除 6 行
206 行未改动全部展开207208209210211211212213214215162 行未改动全部展开378379380381382382383384385386228 行未改动全部展开61561661761861961962062162262323 行未改动64764864965065165165265365465530 行未改动686687688689690690691692693694347 行未改动全部展开10421043104410451046104610471048104910501051120 行未改动全部展开206 行未改动全部展开$0\ 2\| 4\ 6\ |1\ 3\| 5\ 7$
$0\ | 4\ | 2\ | 6\ | 1\ | 5\ | 3\ | 7$
$0\ 4\ 2\ 6\ 1\ 5\ 3\ 7$ $0\ 4\ 2\ 6\ 1\ 5\ 3\ 7$
发现当这个数二进制下末尾是 $1$ 时,它会被分到右半边,否则被分到左半边,这是第一位的影响,第二位第三位同理。
比如说 $3= (011)_2$。162 行未改动全部展开#define int long long#define db long doubleusing namespace std;const int MOD=998244353;const int G=114514; const int G=114514;const int maxn=(1<<22)+7;inline int qpow(int a,int b){ int ans=1; while(b){228 行未改动全部展开 memset(f,0,sizeof(int)*LIM),memset(g,0,sizeof(int)*LIM); return H;}Poly inv(const Poly &F){ static int g[maxn<<1]; static int g[maxn<<1]; static int fp[maxn<<1],tmp[maxn<<1]; int df=F.size(); for(int i=0;i<df;i++){ fp[i]=F[i];23 行未改动 for(int i=0;i<n;i++)cin>>F[i]; Poly G=inv(F); for(int i=0;i<G.size();i++)cout<<G[i]<<" "; cout<<endl;} }```或许有人会问:这里为什么不直接用封装的乘法呢?
因为上面封装的多项式乘法用了三次 DFT,上面的牛迭有三次乘法,每迭代一次就是 9 次 DFT,常数爆炸。30 行未改动 G[i]=G[i+1]*(i+1)%mod; } G.resize(F.size()-1); return G;} }Poly intg(const Poly &F){ Poly G=F;G.resize(F.size()+1); for(int i=F.size();i>=1;i--)G[i]=G[i-1]*(qpow(i,mod-2))%mod; G[0]=0;347 行未改动全部展开 R=R+x(*T)q[mid+1,r]; L=L+y(*T)q[l,mid]; slv(l,mid); slv(mid+1,r);
```
这里不 resize 会似掉。
120 行未改动全部展开