QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#308379#4794. SalajKLPP#WA 145ms53024kbC++201.0kb2024-01-20 01:19:252024-01-20 01:19:25

Judging History

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

  • [2024-01-20 01:19:25]
  • 评测
  • 测评结果:WA
  • 用时:145ms
  • 内存:53024kb
  • [2024-01-20 01:19:25]
  • 提交

answer

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
typedef long long int lld;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define trav(a,v) for(auto a:v)
lld MOD;
const int mx=55;
lld DP[mx*mx][mx][mx];
void solve(){
	int n,m;
	//~ n=50;
	//~ m=n*(n-1);
	//~ MOD=1e9+7;
	cin>>n>>m>>MOD;
	rep(i,0,m+1){
		rep(j,0,n+1){
			rep(k,0,n+1){
				DP[i][j][k]=0;
			}
		}
	}
	DP[0][n][1]=1;
	rep(i,0,m){
		rep(j,0,n+1){
			rep(k,0,n+1){
				DP[i][j][k]%=MOD;
				DP[i+1][j][min(n,k+1)]+=DP[i][j][k];
				rep(l,1,j){
					if(k-(j-l)>0)DP[i+1][l][k-(j-l)]+=DP[i][j][k];
				}
			}
		}
	}
	rep(i,1,m+1){
		lld ans=0;
		rep(j,0,n+1){
			rep(k,0,n+1){
				ans+=DP[i][j][k];
				ans%=MOD;
			}
		}
		cout<<ans<<" ";
	}cout<<"\n";
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int tt=1;
	cin>>tt;
	while(tt--){
		solve();
	}
}

详细

Test #1:

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

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: 145ms
memory: 53024kb

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'