結果

問題 No.1465 Archaea
コンテスト
ユーザー koheijkt
提出日時 2025-12-18 20:18:53
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 53 ms / 2,000 ms
+ 381µs
コード長 388 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 134 ms
コンパイル使用メモリ 63,808 KB
実行使用メモリ 62,180 KB
最終ジャッジ日時 2026-11-14 02:28:23
合計ジャッジ時間 3,299 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

INF = 10**18
from collections import deque
N, K = map(int, input().split())
dist = [INF]*(N + 1)
dist[1] = 0
que = deque([1])
while que:
    pos = que.popleft()
    for nex in [pos + 3, 2*pos]:
        if nex > N:
            continue
        if dist[nex] == INF:
            dist[nex] = dist[pos] + 1
            que.append(nex)

if dist[-1] <= K:
    print('YES')
else:
    print('NO')
0