結果
問題 |
No.1465 Archaea
|
ユーザー |
![]() |
提出日時 | 2021-04-02 22:27:45 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 845 bytes |
コンパイル時間 | 6,861 ms |
コンパイル使用メモリ | 260,872 KB |
最終ジャッジ日時 | 2025-01-20 09:35:43 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 MLE * 1 |
other | AC * 9 WA * 6 TLE * 4 MLE * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++) void solve() { ll n, k; cin >> n >> k; const ll inf = 1e18; vector<ll> d(n+1, inf); using pl = pair<ll,ll>; queue<pl> que; que.push({n, 0}); while(!que.empty()) { auto [m, cnt] = que.front(); que.pop(); if(cnt == k) { if(m == 1) { cout << "YES\n"; return; } } else { if(m - 3 * (k - cnt) < -100) continue; if(m % 2 == 0 && m / 2 >= 1) que.push({m / 2, cnt + 1}); if(m - 3 >= 1) que.push({m - 3, cnt + 1}); } } cout << "NO\n"; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); solve(); return 0; }