結果

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

テストケース

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