提交时间:2026-04-11 15:56:22

运行 ID: 41214

#include<bits/stdc++.h> #define up(i,l,r) for(int i=(l);i<=(r);++i) #define down(i,l,r) for(int i=(l);i>=(r);--i) #define pi pair<int,int> #define p1 first #define p2 second #define m_p make_pair #define pb push_back #define eb emplace_back using namespace std; typedef long long ll; typedef unsigned long long ull; inline ll read(){ ll x=0;short t=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();} while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar(); return x*t; } const int p=998244353; int n,k; ull f[2][20005]; ull s[10005]; ull res[10005]; int fac[10005],ifac[10005]; inline int qp(int a,int b){ int res=1; for(;b;b>>=1,a=a*1llu*a%p)if(b&1)res=res*1llu*a%p; return res; } inline int add(int a,int b){if((a+=b)>=p)a-=p;return a;} void slv(){ n=read(),k=read(); fac[0]=ifac[0]=1;up(i,1,n)fac[i]=fac[i-1]*1llu*i%p,ifac[i]=qp(fac[i],p-2); f[0][0]=1; up(i,1,n){ int op=i&1;up(j,0,2*i)f[op][j]=0; int s=0; up(j,0,2*(i-1)){ f[op][j+1]+=f[!op][j]*1llu*((s+=j)<<1); f[op][j]+=f[!op][j]*1llu*(s-j); f[op][j+2]+=f[!op][j]*1llu*(s+j+1); } ull sm=0; up(j,0,2*i)f[op][j]%=p,sm+=f[op][j];res[i]=sm%p; res[i]=qp(res[i],k); } s[0]=1; up(i,1,n){ int op=i&1; down(j,i,1)s[j]=(s[j-1]+s[j]*1llu*j)%p;s[0]=0;__int128_t nw=0; up(j,1,i-1)nw+=res[j]*1llu*s[j];nw%=p; res[i]=(res[i]+p-(int)nw)%p; } up(i,1,n)res[i]=res[i]*1llu*ifac[i]%p; up(i,1,n)printf("%llu\n",res[i]); } int main(){ slv(); return 0; }