QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#498416#8815. Space Stationwy2025WA 0ms9804kbC++14914b2024-07-30 14:14:232024-07-30 14:14:24

Judging History

你现在查看的是最新测评结果

  • [2024-07-30 16:51:06]
  • hack成功,自动添加数据
  • (/hack/760)
  • [2024-07-30 14:14:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:9804kb
  • [2024-07-30 14:14:23]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=101,M=998244353;
int n,m,s[N],a[N],jc[N],inv[N],dp[N][N][N*200];

int ksm(int a,int b=M-2){int ans=1;while(b){if(b&1) ans=ans*a%M;b>>=1,a=a*a%M;}return ans;}

void init(){
	jc[0]=jc[1]=inv[0]=inv[1]=1;
	for(int i=2;i<N;i++)
		jc[i]=jc[i-1]*i%M,
		inv[i]=ksm(jc[i]);
}

int iC(int n,int m){return inv[n]*jc[m]%M*jc[n-m]%M;}

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	init();
	for(int i=1;i<=n;i++) cin>>a[i],s[i]+=a[i];
	dp[0][0][0]=1;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=i;j++)
			for(int k=0;k<=s[i];k++){
				dp[i][j][k]=dp[i-1][j][k];
				if(j&&k>=a[i]) dp[i][j][k]=(dp[i][j][k]+dp[i-1][j-1][k-a[i]])%M;
			}
	int ans=0;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=s[i];j++)
			ans=(ans+dp[n][i][j]*iC(n,i)%M*min(m*i,j)%M*ksm(i)%M)%M;
	cout<<ans;
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 9804kb

input:

3 3
2 3 4

output:

665496236

result:

wrong answer 1st numbers differ - expected: '499122185', found: '665496236'