結果
問題 | No.1465 Archaea |
ユーザー |
|
提出日時 | 2021-04-02 22:41:32 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 731 bytes |
コンパイル時間 | 3,688 ms |
コンパイル使用メモリ | 140,676 KB |
実行使用メモリ | 12,032 KB |
最終ジャッジ日時 | 2024-12-24 01:22:19 |
合計ジャッジ時間 | 4,658 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; using ll = long long; int main() { int n, k; cin >> n >> k; vector<vector<int>> dp(n + 10); dp[1].push_back(0); for(int i = 1; i < n; i++) { if(dp[i].size() == 0) { continue; } int tmp = *min_element(dp[i].begin(), dp[i].end()); if(tmp >= k) { continue; } dp[i + 3].push_back(tmp + 1); if(i * 2 <= n) { dp[i * 2].push_back(tmp + 1); } } if(dp[n].size() > 0) { cout << "YES\n"; } else { cout << "NO\n"; } return 0; }