結果

問題 No.3046 yukicoderの過去問
ユーザー okkuukenkenokkuukenken
提出日時 2022-08-19 14:41:02
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 799 bytes
コンパイル時間 2,262 ms
コンパイル使用メモリ 151,192 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-16 19:31:28
合計ジャッジ時間 5,636 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<random>
#include<bitset>
#include<cassert>
#include<complex>
#include<fstream>
#include<cstdlib>
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