| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 41197 | LYLAKIOI | 【BJ】T2 | C++ | 通过 | 100 | 581 MS | 880 KB | 1649 | 2026-04-11 15:44:22 |
#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]; int res[10005],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); } up(j,0,2*i)f[op][j]%=p,res[i]=add(res[i],f[op][j]); 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;ull nw=0; up(j,1,i-1){nw+=res[j]*1llu*s[j];if(j&15)nw%=p;}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("%d\n",res[i]); } int main(){ slv(); return 0; }