QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#223631#7063. Space Stationveg#WA 5ms4220kbC++14649b2023-10-22 14:29:192023-10-22 14:29:20

Judging History

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

  • [2023-10-22 14:29:20]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:4220kb
  • [2023-10-22 14:29:19]
  • 提交

answer

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

const int maxn=1e5+10;
const int mod=1e9+7;

int a[60];
int jc[maxn];
int ans;

void dfs(int rem,int n,int tmp)
{
	if(rem>=50||!n)
	{
		ans=(ans+1ll*tmp*jc[n])%mod;
		return;
	}
	for(int i=1;i<=rem;i++)
		if(a[i])
		{
			a[i]--;
			dfs(rem+i,n-1,1ll*tmp*(a[i]+1)%mod);
			a[i]++;
		}
}

int main()
{
	int n,rem;
	scanf("%d%d",&n,&rem);
	jc[0]=1;
	for(int i=1;i<=n;i++) jc[i]=1ll*jc[i-1]*i%mod;
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		a[x]++;
	}
	dfs(rem,n,1);
	for(int i=1;i<=a[0];i++) ans=1ll*ans*(n-i+1)%mod;
	printf("%d\n",ans);
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3920kb

input:

3
2 1 2 3

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3968kb

input:

5
1 1 1 1 2 3

output:

54

result:

ok single line: '54'

Test #3:

score: -100
Wrong Answer
time: 5ms
memory: 4220kb

input:

100000
47 25 43 22 17 6 15 17 45 4 14 34 46 22 0 8 2 48 41 6 49 42 21 25 48 43 2 17 27 25 38 31 39 48 13 49 24 30 36 19 29 47 48 1 4 5 12 9 21 39 30 21 8 4 9 45 18 0 3 29 26 18 24 39 31 49 22 4 46 21 27 11 11 7 8 3 26 25 29 4 1 21 34 4 44 39 13 26 33 44 5 17 10 32 37 25 44 34 17 14 40 32 27 39 41 6 ...

output:

940012419

result:

wrong answer 1st lines differ - expected: '268605493', found: '940012419'