結果
| 問題 |
No.8046 yukicoderの過去問
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-18 08:00:45 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 907 bytes |
| コンパイル時間 | 7,403 ms |
| コンパイル使用メモリ | 155,476 KB |
| 最終ジャッジ日時 | 2025-01-13 02:52:29 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 TLE * 5 |
ソースコード
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
return (ull)rng() % B;
}
constexpr int mod=1000000007;
int n,k,x;
int dp[100010];
int f[100010];
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
cin >> k >> n;
for(int i=0;i<n;i++){
cin >> x;
f[x]=1;
}
dp[0]=1;
for(int i=0;i<k;i++){
const int v=dp[i];
for(int j=0;j<k-i+1;j++){
dp[i+j]+=v*f[j];
dp[i+j]-=mod*(dp[i+j]>=mod);
}
}
cout << dp[k] << "\n";
}