結果

問題 No.3046 yukicoderの過去問
ユーザー okkuukenkenokkuukenken
提出日時 2022-08-19 14:43:09
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 453 bytes
コンパイル時間 4,734 ms
コンパイル使用メモリ 291,008 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-04-16 19:33:12
合計ジャッジ時間 8,235 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,756 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353;
const int dx[]={1,0,0,-1},dy[]={0,1,-1,0};
bool flg[100001];
int dp[100001];
int main(){
	int k,n,x;
	cin>>k>>n;
	while(cin>>x)
		flg[x]=1;
	dp[0]=1;
	for(int i=0;i<k;i++){
		const int tmp=dp[i];
		for(int j=1;j<=k-i;j++){
			dp[i+j]+=tmp*flg[j];
			dp[i+j]-=mod*(dp[i+j]>=mod);
		}
	}
	cout<<dp[k]<<endl;
}
0