結果

問題 No.3046 yukicoderの過去問
ユーザー beetbeet
提出日時 2019-04-03 20:48:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 578 bytes
コンパイル時間 866 ms
コンパイル使用メモリ 74,096 KB
実行使用メモリ 4,404 KB
最終ジャッジ日時 2023-08-24 20:50:43
合計ジャッジ時間 7,825 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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