提交记录 22457


用户 题目 状态 得分 用时 内存 语言 代码长度
qwqwqwq 1002i. 【模板题】多项式乘法 Accepted 100 49.544 ms 5696 KB C++17 841 B
提交时间 评测时间
2024-09-01 14:18:55 2024-09-01 14:19:00
#pragma GCC optimize("Ofast")
#include<iostream>
using U=unsigned;using V=unsigned long long;constexpr U P=998244353,N=1<<18;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;}U R[N],T[N]{0,1};void f(U*a){for(U b=1;b^N;b++)if(R[b]<b)a[b]^=a[R[b]]^=a[b]^=a[R[b]];for(U b=1,c,d,e,f;b^N;b*=2)for(c=0;c^N;c+=b*2)for(d=0;d^b;d++)e=a[c+d],f=(V)a[b+c+d]*T[b+d]%P,(a[c+d]=e+f)>=P&&(a[c+d]-=P),(a[b+c+d]=e-f)>=P&&(a[b+c+d]+=P);}main(){for(U a=1;a^N;a++)R[a]=(R[a/2]+a%2*N)/2;for(U a=2,b,c;a^N;a*=2)for(b=F(3,P/a/2),c=a/2;c^a;c++)T[c*2]=T[c],T[c*2+1]=(V)T[c]*b%P;std::cin.tie(0)->sync_with_stdio(0);U a,b,c[N]{},d[N]{};std::cin>>a>>b;for(U e=0;e<=a;e++)std::cin>>c[e];for(U e=0;e<=b;e++)std::cin>>d[e];f(c),f(d);for(U e=0;e^N;e++)c[e]=(V)c[e]*d[e]%P;f(c);for(U e=0,f=F(N,P-2);e<=a+b;e++)std::cout<<(V)c[(N-e)%N]*f%P<<' ';}

CompilationN/AN/ACompile OKScore: N/A

Subtask #1 Testcase #124.804 ms4 MB + 60 KBAcceptedScore: 100

Subtask #1 Testcase #248.73 ms5 MB + 496 KBAcceptedScore: 0

Subtask #1 Testcase #335.335 ms4 MB + 348 KBAcceptedScore: 0

Subtask #1 Testcase #435.322 ms4 MB + 336 KBAcceptedScore: 0

Subtask #1 Testcase #524.809 ms4 MB + 60 KBAcceptedScore: 0

Subtask #1 Testcase #624.791 ms4 MB + 60 KBAcceptedScore: 0

Subtask #1 Testcase #724.786 ms4 MB + 60 KBAcceptedScore: 0

Subtask #1 Testcase #844.542 ms5 MB + 228 KBAcceptedScore: 0

Subtask #1 Testcase #944.576 ms5 MB + 228 KBAcceptedScore: 0

Subtask #1 Testcase #1040.355 ms4 MB + 984 KBAcceptedScore: 0

Subtask #1 Testcase #1149.544 ms5 MB + 576 KBAcceptedScore: 0

Subtask #1 Testcase #1245.023 ms4 MB + 456 KBAcceptedScore: 0

Subtask #1 Testcase #1324.777 ms4 MB + 60 KBAcceptedScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:10:54 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠