結果
| 問題 |
No.8046 yukicoderの過去問
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-31 19:59:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 719 bytes |
| コンパイル時間 | 828 ms |
| コンパイル使用メモリ | 78,376 KB |
| 実行使用メモリ | 16,068 KB |
| 最終ジャッジ日時 | 2025-05-31 19:59:20 |
| 合計ジャッジ時間 | 4,822 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 TLE * 1 -- * 2 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
int BIG_N = 1000000007;
int main(){
int K = 0, N = 0;
std::cin >> K;
std::cin >> N;
std::vector<int> X;
for (int i = 0; i < N; i++){
int x = 0;
std::cin >> x;
X.push_back(x);
}
std::vector<int> kaidan(K + 1);
kaidan[0] = 1;
for (int k_idx = 0; k_idx < kaidan.size() - 1; k_idx++) {
if (kaidan[k_idx] == 0) continue;
int cur = kaidan[k_idx];
for (auto x: X) {
if (k_idx + x < kaidan.size()) {
kaidan[k_idx + x] += cur;
kaidan[k_idx + x] %= BIG_N;
}
}
}
// for (auto k : kaidan) {
// std::cout << k << std::endl;
// }
std::cout << kaidan[kaidan.size() - 1] << std::endl;
}