結果
問題 |
No.269 見栄っ張りの募金活動
|
ユーザー |
|
提出日時 | 2024-02-05 23:04:39 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,140 bytes |
コンパイル時間 | 3,472 ms |
コンパイル使用メモリ | 259,620 KB |
実行使用メモリ | 370,944 KB |
最終ジャッジ日時 | 2024-09-28 11:48:44 |
合計ジャッジ時間 | 10,423 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | AC * 1 -- * 21 |
ソースコード
#include <bits/stdc++.h> constexpr std::int64_t MOD = 1e9 + 7; int main() { std::int64_t N, S, K; std::cin >> N >> S >> K; std::vector<std::vector<std::map<std::int64_t, std::int64_t>>> dp(N + 1, std::vector<std::map<std::int64_t, std::int64_t>>(S + 1)); // endo for (auto i : std::views::iota(0, S + 1)) dp[0][i][i] = 1; std::int64_t result = 0; for (auto i : std::views::iota(1, N)) { for (auto j : std::views::iota(K, S + 1)) { if (j > 0) for (auto [index, value] : dp[i][j - 1]) { if (index <= S) dp[i][j][index + 1] = (dp[i][j][index + 1] + value) % MOD; } for (auto [index, value] : dp[i - 1][j - K]) { if (index + j <= S) dp[i][j][index + j] = (dp[i][j][index + j] + value) % MOD; } } // release dp[i - 1].clear(); } for (auto j : std::views::iota(K, S + 1)) { result = (result + dp[N - 1][j][S]) % MOD; } std::cout << result << std::endl; return 0; }