結果
| 問題 |
No.8046 yukicoderの過去問
|
| コンテスト | |
| ユーザー |
zelnyok
|
| 提出日時 | 2019-06-29 11:35:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,105 bytes |
| コンパイル時間 | 988 ms |
| コンパイル使用メモリ | 108,004 KB |
| 実行使用メモリ | 15,616 KB |
| 最終ジャッジ日時 | 2024-07-02 05:28:35 |
| 合計ジャッジ時間 | 4,653 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 TLE * 1 -- * 2 |
ソースコード
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"
#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()
#define MOD 1000000007
signed main() {
int k,n;
std::cin >> k >> n;
std::vector<int> x(n);
rep(i,n) std::cin >> x[i];
std::map<int,int> dp;
dp[0] = 1;
for(auto& i:dp) {
for(auto& j:x) {
int next = i.first+j;
if(next>k) break;
dp[next] = (dp[next] + i.second)%MOD;
}
}
print(dp[k]);
return 0;
}
zelnyok