QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#129232#2573. Two PermutationsxlaoWA 2ms3888kbC++14664b2023-07-22 11:14:002023-07-22 11:14:02

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-22 11:14:02]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3888kb
  • [2023-07-22 11:14:00]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int N=60, mod=998244353;
inline void _Add(int &x,int y) {x+=y; if(x>=mod) x-=mod;}

int n,m,f[N][N][N*N];
int main()
{
	scanf("%d %d",&n,&m);
	f[0][0][0]=1;
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<=i;++j)
		{
			for(int k=0;k<=i*i;++k)
			{
				_Add(f[i+1][j+1][k+i+1], f[i][j][k]);
				_Add(f[i+1][j][k], f[i][j][k]);
				_Add(f[i+1][j+1][k+i+1], 2ll*f[i][j][k]*(i-j)%mod);
				_Add(f[i+1][j+2][k+i+1+i+1], 1ll*f[i][j][k]*(i-j)%mod*(i-j)%mod);
			}
		}
	}
	int ans=0;
	for(int k=m;k<=n*n;++k) _Add(ans, f[n][n][k]);
	for(int i=1;i<=n;++i) ans = 1ll*ans*i%mod;
	printf("%d\n",ans);
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3696kb

input:

2 4

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3888kb

input:

3 7

output:

30

result:

wrong answer 1st numbers differ - expected: '12', found: '30'