結果

問題 No.1465 Archaea
ユーザー wolgnik
提出日時 2021-03-07 23:10:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-24 01:06:54
合計ジャッジ時間 1,953 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N, K = map(int, input().split())
res = 10 ** 10

import heapq
hpush = heapq.heappush
hpop = heapq.heappop
h = [(0, N)]

while len(h):
  c, x = hpop(h)
  if x < 1 or c > K: continue
  if x % 3 == 1: res = min(res, x // 3 + c)
  if x % 2: hpush(h, (c + 2, (x - 3) // 2))
  else: hpush(h, (c + 1, x // 2))
  if res <= K:
    print("YES")
    exit(0)
print("NO")
0