結果
| 問題 |
No.8046 yukicoderの過去問
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-19 14:47:34 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,406 ms / 2,000 ms |
| コード長 | 438 bytes |
| コンパイル時間 | 5,461 ms |
| コンパイル使用メモリ | 259,856 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-07 21:12:39 |
| 合計ジャッジ時間 | 11,374 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
ソースコード
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int flg[100001];
int dp[100001];
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
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[j+i]+=tmp*flg[j];
dp[j+i]-=mod*(dp[j+i]>=mod);
}
}
cout<<dp[k]<<endl;
}