結果
| 問題 | 
                            No.8046 yukicoderの過去問
                             | 
                    
| コンテスト | |
| ユーザー | 
                             zelnyok
                         | 
                    
| 提出日時 | 2019-06-29 11:30:56 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,096 bytes | 
| コンパイル時間 | 908 ms | 
| コンパイル使用メモリ | 96,828 KB | 
| 実行使用メモリ | 17,180 KB | 
| 最終ジャッジ日時 | 2024-07-02 05:27:19 | 
| 合計ジャッジ時間 | 4,633 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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) dp[next] = (dp[next] + i.second)%MOD;
		}
	}
	print(dp[k]);
	return 0;
}
            
            
            
        
            
zelnyok