#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<<' ';}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Subtask #1 Testcase #1 | 24.804 ms | 4 MB + 60 KB | Accepted | Score: 100 | 显示更多 |
Subtask #1 Testcase #2 | 48.73 ms | 5 MB + 496 KB | Accepted | Score: 0 | 显示更多 |
Subtask #1 Testcase #3 | 35.335 ms | 4 MB + 348 KB | Accepted | Score: 0 | 显示更多 |
Subtask #1 Testcase #4 | 35.322 ms | 4 MB + 336 KB | Accepted | Score: 0 | 显示更多 |
Subtask #1 Testcase #5 | 24.809 ms | 4 MB + 60 KB | Accepted | Score: 0 | 显示更多 |
Subtask #1 Testcase #6 | 24.791 ms | 4 MB + 60 KB | Accepted | Score: 0 | 显示更多 |
Subtask #1 Testcase #7 | 24.786 ms | 4 MB + 60 KB | Accepted | Score: 0 | 显示更多 |
Subtask #1 Testcase #8 | 44.542 ms | 5 MB + 228 KB | Accepted | Score: 0 | 显示更多 |
Subtask #1 Testcase #9 | 44.576 ms | 5 MB + 228 KB | Accepted | Score: 0 | 显示更多 |
Subtask #1 Testcase #10 | 40.355 ms | 4 MB + 984 KB | Accepted | Score: 0 | 显示更多 |
Subtask #1 Testcase #11 | 49.544 ms | 5 MB + 576 KB | Accepted | Score: 0 | 显示更多 |
Subtask #1 Testcase #12 | 45.023 ms | 4 MB + 456 KB | Accepted | Score: 0 | 显示更多 |
Subtask #1 Testcase #13 | 24.777 ms | 4 MB + 60 KB | Accepted | Score: 0 | 显示更多 |