結果

問題 No.1956 猫の額
ユーザー testestesttestestest
提出日時 2022-04-10 06:15:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 534 bytes
コンパイル時間 2,081 ms
コンパイル使用メモリ 202,372 KB
実行使用メモリ 24,664 KB
最終ジャッジ日時 2023-10-20 17:58:46
合計ジャッジ時間 8,761 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 14 ms
5,524 KB
testcase_02 MLE -
testcase_03 AC 21 ms
6,304 KB
testcase_04 AC 307 ms
13,724 KB
testcase_05 AC 269 ms
12,944 KB
testcase_06 AC 272 ms
12,164 KB
testcase_07 MLE -
testcase_08 MLE -
testcase_09 AC 39 ms
7,976 KB
testcase_10 MLE -
testcase_11 AC 177 ms
10,540 KB
testcase_12 MLE -
testcase_13 AC 3 ms
4,348 KB
testcase_14 AC 40 ms
4,784 KB
testcase_15 AC 15 ms
5,800 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
	int N,C,mod;
	cin >> N >> mod >> C;
	int A[N];
	int S=0;
	for(int i=0;i<N;i++)cin >> A[i];
	for(int i=0;i<N;i++)S+=A[i];

	int dp[C+1][S+1];
	memset(dp,0,(C+1)*(S+1)*sizeof(int));
	int sum=0;
	dp[0][0]=1;
	for(int i=0;i<N;i++){
		for(int j=min(i,C-1);j>=0;j--){
			for(int k=0;k<=min(sum,S-A[i]);k++)dp[j+1][k+A[i]]=(dp[j+1][k+A[i]]+dp[j][k])%mod;
		}
		sum+=A[i];
	}
	for(int i=1;i<=S;i++){
		if(i!=1)cout << ' ';
		cout << dp[C][i];
	}
	cout << '\n';
}
0