QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#344787#4794. SalajKevin5307WA 441ms74624kbC++20677b2024-03-05 12:21:062024-03-05 12:21:07

Judging History

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

  • [2024-03-05 12:21:07]
  • 评测
  • 测评结果:WA
  • 用时:441ms
  • 内存:74624kb
  • [2024-03-05 12:21:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll dp[3003][55][55],mod;
void upd(ll &a,ll b)
{
	a+=b;
	a%=mod;
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,m;
		cin>>n>>m>>mod;
		memset(dp,0,sizeof(dp));
		dp[0][0][n]=1;
		for(int i=1;i<=m;i++)
			for(int j=0;j<=n-1;j++)
				for(int k=1;k<=n;k++)
				{
					upd(dp[i][min(n-1,j+1)][k],dp[i-1][j][k]);
					for(int x=1;x<=min(j,k-1);x++)
						upd(dp[i][j-x][k-x],dp[i-1][j][k]);
				}
		for(int ii=1;ii<=m;ii++)
		{
			ll ans=0;
			for(int i=0;i<=n;i++)
				for(int j=0;j<=n;j++)
					upd(ans,dp[ii][i][j]);
			cout<<ans<<' ';
		}
		cout<<'\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 17ms
memory: 74516kb

input:

2
5 10 666013
6 9 10

output:

1 2 4 9 21 50 110 209 351 546 
1 2 4 9 1 1 6 0 7 

result:

ok 19 numbers

Test #2:

score: -100
Wrong Answer
time: 441ms
memory: 74624kb

input:

10
31 248 8654701
13 11 331266209
33 517 52876477
26 580 675225807
48 2029 311070528
26 31 327981899
39 25 644128037
29 776 464963196
43 799 451592950
25 184 564388620

output:

1 2 4 9 21 51 127 323 835 2188 5798 15511 41835 113634 310572 853467 2356779 6536382 889882 7578514 4072343 2646977 4649285 7797829 7894657 8630011 5369867 7539674 4332126 8201689 8589675 2709364 4018535 3531401 5490003 4890382 334630 1280966 7295275 4971992 1680824 7744560 2450701 2716471 1097918 5...

result:

wrong answer 1102nd numbers differ - expected: '546820274', found: '546820275'