QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#746449#9611. 木桶效应ANIG0 16ms3664kbC++14980b2024-11-14 14:40:092024-11-14 14:40:10

Judging History

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

  • [2024-11-14 14:40:10]
  • 评测
  • 测评结果:0
  • 用时:16ms
  • 内存:3664kb
  • [2024-11-14 14:40:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=55,M=1e5+5,mods=998244353;
int pows(int a,int b){
	if(b==0)return 1;
	int res=pows(a,b>>1);
	res=res*res%mods;
	if(b&1)res=res*a%mods;
	return res;
}
int n,m,qs,f[N][N],jc[M],ny[M];
int C(int a,int b){
	if(a<0||b<0||a<b)return 0;
	return jc[a]*ny[b]%mods*ny[a-b]%mods;
}
signed main(){
	cin>>n>>m>>qs;
	jc[0]=ny[0]=1;
	for(int i=1;i<=n*m;i++)jc[i]=jc[i-1]*i%mods,ny[i]=pows(jc[i],mods-2);
	f[0][n]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<=n;j++){
			for(int k=0;k<=j;k++){
				for(int l=0;l<=m;l++){
					int ans=0;
					for(int r=0;r<=k;r++){
						int tmp=C((k-r)*m,m-l)*C(k,r)%mods;
						if(r&1)ans-=tmp;
						else ans+=tmp;
					}
					ans%=mods;
					f[i+1][j-k]+=f[i][j]*C((n-j-i)*m,l)%mods*ans%mods*pows(i+1,k)%mods;
				}
			}
		}
		for(int j=0;j<=n;j++){
			f[i+1][j]%=mods;
		//	cout<<i+1<<" "<<j<<" "<<f[i+1][j]<<endl;
		}
	}
	cout<<f[n][0];
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

5 3 0

output:

74787960

result:

wrong answer 1st lines differ - expected: '21412920', found: '74787960'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #7:

score: 0
Wrong Answer
time: 16ms
memory: 3540kb

input:

50 1 0

output:

700438304

result:

wrong answer 1st lines differ - expected: '263941435', found: '700438304'

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #2:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #6:

0%

Subtask #8:

score: 0
Skipped

Dependency #7:

0%

Subtask #9:

score: 0
Skipped

Dependency #8:

0%