結果

問題 No.8046 yukicoderの過去問
ユーザー beet
提出日時 2019-04-03 20:48:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 578 bytes
コンパイル時間 867 ms
コンパイル使用メモリ 75,492 KB
最終ジャッジ日時 2025-01-07 01:24:29
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")

#include<iostream>
using namespace std;

struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
const int MAX = 1<<17;
const int MOD = 1e9+7;
int x[MAX]={};
int dp[MAX]={};

signed main(){
  int k,n;
  cin>>k>>n;
  for(int i=0;i<n;i++){
    int p;
    cin>>p;
    x[p]=1;
  }
  dp[0]=1;
  for(int l=0;l<k;l++){
    const int v=dp[l]%MOD;
    for(int i=0;l+i<=k;i++){
      dp[l+i]+=v;
      dp[l+i]-=MOD*(dp[l+i]>=MOD);
    }
  }
  cout<<dp[k]<<endl;
  return 0;
}

0