結果
問題 |
No.1465 Archaea
|
ユーザー |
|
提出日時 | 2025-08-17 01:35:06 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 888 bytes |
コンパイル時間 | 3,153 ms |
コンパイル使用メモリ | 281,416 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-17 01:35:10 |
合計ジャッジ時間 | 4,228 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i) #define all(a) (a).begin(),(a).end() int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int N, K; cin >> N >> K; vector<int> dist(N + 1, -1); queue<int> que; dist[1] = 1; que.push(1); while (!que.empty()) { int M = que.front(); que.pop(); if (2 * M <= N) { if (dist[2 * M] == -1) { dist[2 * M] = dist[M] + 1; que.push(2 * M); } } if (M + 3 <= N) { if (dist[M + 3] == -1) { dist[M + 3] = dist[M] + 1; que.push(M + 3); } } } if (dist[N] == -1 || dist[N] > K) cout << "NO\n"; else cout << "YES\n"; }