結果
問題 |
No.8046 yukicoderの過去問
|
ユーザー |
![]() |
提出日時 | 2019-06-29 11:32:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,116 bytes |
コンパイル時間 | 1,107 ms |
コンパイル使用メモリ | 108,760 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-02 05:28:25 |
合計ジャッジ時間 | 1,826 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 8 |
ソースコード
#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::unordered_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; }