中间用的了一个简单的小性质
[egin{align*}
&若 A(x)equiv 0 pmod {x^{n/2}}
\
&则 A(x)*A(x)equiv 0 pmod {x^n}
end{align*}
]
#include<bits/stdc++.h>
#define N 440000
#define eps 1e-7
#define inf 1e9+7
#define db double
#define ll long long
#define ldb long double
#define ull unsigned long long
using namespace std;
inline int read()
{
char ch=0;
int x=0,flag=1;
while(!isdigit(ch)){ch=getchar();if(ch=='-')flag=-1;}
while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0',ch=getchar();}
return x*flag;
}
const int h=3,mo=998244353;
int ksm(int x,int k)
{
int ans=1;
while(k){if(k&1)ans=1ll*ans*x%mo;k>>=1;x=1ll*x*x%mo;}
return ans;
}
int inv(int x){return ksm((x%mo+mo)%mo,mo-2);}
int rev[N];
void ntt(int *f,int n,int flag)
{
for(int i=0;i<n;i++)
{
rev[i]=(rev[i>>1]>>1)+(i&1)*(n>>1);
if(i<rev[i])swap(f[i],f[rev[i]]);
}
for(int k=2,kk=1;k<=n;k<<=1,kk<<=1)
{
int wn=ksm(h,(mo-1)/k);
if(flag==-1)wn=inv(wn);
for(int i=0;i<n;i+=k)
for(int j=0,w=1;j<kk;j++,w=1ll*w*wn%mo)
{
int t=1ll*w*f[i+j+kk]%mo;
f[i+j+kk]=(f[i+j]-t)%mo;
f[i+j]=(f[i+j]+t)%mo;
}
}
if(flag==-1)
{
int k=inv(n);
for(int i=0;i<n;i++)f[i]=(1ll*f[i]*k%mo+mo)%mo;
}
}
int a[N],b[N];
void poly_ml(int n)
{
ntt(a,n,+1);
for(int i=0;i<n;i++)a[i]=1ll*a[i]*a[i]%mo;
ntt(a,n,-1);
}
void poly_mul(int n)
{
ntt(a,n,+1);ntt(b,n,+1);
for(int i=0;i<n;i++)a[i]=1ll*a[i]*b[i]%mo;
ntt(a,n,-1);
}
int v[N],fv[N];
void poly_inv(int m)
{
int n=1;
for(int i=0;i<2*m;i++)v[i]=0;
while(n<2*m)
{
if(n==1){v[0]=inv(fv[0]);n<<=1;continue;}
for(int i=0;i<n;i++)a[i]=v[i],a[i+n]=0;poly_ml(2*n);
for(int i=0;i<n;i++)b[i]=fv[i],a[i+n]=b[i+n]=0;poly_mul(2*n);
for(int i=0;i<n;i++)v[i]=(1ll*2*v[i]%mo-a[i])%mo,v[i+n]=0;
n<<=1;
}
}
int main()
{
int n=read();
for(int i=0;i<n;i++)fv[i]=read();
poly_inv(n);
for(int i=0;i<n;i++)printf("%d ",(v[i]%mo+mo)%mo);
return 0;
}