QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#68464#4794. SalajA_zjzjWA 971ms3536kbC++14541b2022-12-16 17:36:212022-12-16 17:36:22

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-16 17:36:22]
  • 评测
  • 测评结果:WA
  • 用时:971ms
  • 内存:3536kb
  • [2022-12-16 17:36:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;using ll=long long;const int N=55,M=N*N;
int T,n,m,mod,f[N][N],g[N][N];
void get(){
	cin>>n>>m>>mod;memset(f,0,sizeof f);f[n][0]=1;for(int i=1;i<=m;i++){
		memcpy(g,f,sizeof f);for(int j=1;j<=n;j++)for(int x=0;x<n;x++){
			if(n-j+x>i||i>n*(n+1)/2+(n-j+1)*(n-j)/2)continue;
			if(x)for(int y=j+1;y<=n;y++)(f[j][x]+=g[y][x-1])%=mod;
		}int s=0;for(int j=1;j<=n;j++)for(int x=0;x<=n;x++)(s+=f[j][x])%=mod;printf("%d%c",s,"\n "[i<m]);
	}
}
int main(){
	for(cin>>T;T--;)get();return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 971ms
memory: 3488kb

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'