結果

問題 No.1956 猫の額
ユーザー testestesttestestest
提出日時 2022-04-10 05:19:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 590 bytes
コンパイル時間 4,306 ms
コンパイル使用メモリ 266,216 KB
実行使用メモリ 24,992 KB
最終ジャッジ日時 2023-10-20 17:56:51
合計ジャッジ時間 9,387 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 12 ms
5,720 KB
testcase_02 MLE -
testcase_03 AC 16 ms
6,512 KB
testcase_04 AC 196 ms
13,904 KB
testcase_05 AC 165 ms
13,112 KB
testcase_06 AC 166 ms
12,320 KB
testcase_07 MLE -
testcase_08 MLE -
testcase_09 AC 29 ms
8,096 KB
testcase_10 MLE -
testcase_11 AC 107 ms
10,476 KB
testcase_12 MLE -
testcase_13 AC 3 ms
4,348 KB
testcase_14 AC 24 ms
4,664 KB
testcase_15 AC 13 ms
5,984 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
	int N,C,mod;
	cin >> N >> mod >> C;
	vector<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];

	modint::set_mod(mod);
	vector<vector<modint>>dp(C+1,vector<modint>(S+1));
	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][k];
		}
		sum+=A[i];
	}
	for(int i=1;i<=S;i++){
		if(i!=1)cout << ' ';
		cout << dp[C][i].val();
	}
	cout << '\n';
}
0