提交记录 22454


用户 题目 状态 得分 用时 内存 语言 代码长度
qwqwqwq 1002. 测测你的多项式乘法 Accepted 100 568.172 ms 32400 KB C++17 723 B
提交时间 评测时间
2024-09-01 14:02:54 2024-09-01 14:02:57
#pragma GCC optimize("Ofast")
using U=unsigned;using V=unsigned long long;constexpr U P=998244353,N=1<<21;
constexpr U F(U a,U b){U c=1;for(;b;b/=2)b&1&&(c=(V)c*a%P),a=(V)a*a%P;return c;}
void f(U*a){U b[N]{};for(U c=1;c<N;c++)if((b[c]=b[c>>1]>>1|(c&1)*N/2)<c)a[c]^=a[b[c]]^=a[c]^=a[b[c]];for(U c=1,d,e,f,g,h,i,j;c<N;c=d)for(e=F(3,P/(d=c*2)),f=0;f<N;f+=d)for(g=1,h=f;h<f+c;g=(V)g*e%P,h++)i=a[h],j=(V)a[h+c]*g%P,(a[h]=i+j)>=P&&(a[h]-=P),(a[h+c]=P+i-j)>=P&&(a[h+c]-=P);}
void poly_multiply(U*a,int b,U*c,int d,U*e){U g[N]{},h[N]{};__builtin_memcpy(g,a,b*4+4),__builtin_memcpy(h,c,d*4+4),f(g),f(h);for(U i=0;i<N;i++)g[i]=(V)g[i]*h[i]%P;f(g);for(U i=0,j=F(N,P-2);i<N;i++)h[i]=(V)g[(N-i)%N]*j%P;__builtin_memcpy(e,h,b*4+d*4+4);}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1568.172 ms31 MB + 656 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2025-07-12 21:36:20 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠