結果

問題 No.3046 yukicoderの過去問
ユーザー cielciel
提出日時 2019-04-07 21:00:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 412 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 50,400 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-10 04:38:43
合計ジャッジ時間 4,077 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <vector>
#include <cstdio>
using namespace std;

const int M=1000000007;
int main(){
	int K,N;
	scanf("%d%d",&K,&N);
	vector<int> k(K+1);k[0]=1;
	vector<int> x(K);
	for(int i=0,y;i<N;i++)scanf("%d",&y),x[y]=1;
	for(int l=0;l<K;l++){
		int v=k[l];
		for(int i=0;l+i<=K;i++){
			k[l+i]+=x[i]*v;
			if(k[l+i]>=M)k[l+i]-=M;
		}
	}
	printf("%d\n",k[K]);
}
0