結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,772 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 TLE -
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(N);
	for(int i=0;i<N;i++)scanf("%d",&x[i]);
	for(int i=1;i<=K;i++)for(int j=0;j<N;j++){
		if(i>=x[j]){
			k[i]+=k[i-x[j]];
			if(k[i]>=M)k[i]-=M;
		}
	}
	printf("%d\n",k[K]);
}
0