結果

問題 No.1465 Archaea
ユーザー wolgnikwolgnik
提出日時 2021-03-07 23:09:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 71,396 KB
最終ジャッジ日時 2023-08-25 16:06:47
合計ジャッジ時間 3,199 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,264 KB
testcase_01 AC 71 ms
70,992 KB
testcase_02 AC 70 ms
71,328 KB
testcase_03 AC 69 ms
71,336 KB
testcase_04 AC 70 ms
71,128 KB
testcase_05 AC 67 ms
71,140 KB
testcase_06 AC 68 ms
71,352 KB
testcase_07 AC 67 ms
71,036 KB
testcase_08 AC 69 ms
71,304 KB
testcase_09 AC 67 ms
71,264 KB
testcase_10 AC 70 ms
70,924 KB
testcase_11 AC 67 ms
70,920 KB
testcase_12 AC 68 ms
71,320 KB
testcase_13 AC 69 ms
71,172 KB
testcase_14 AC 67 ms
71,264 KB
testcase_15 AC 68 ms
71,068 KB
testcase_16 AC 68 ms
71,396 KB
testcase_17 AC 68 ms
71,292 KB
testcase_18 AC 67 ms
71,072 KB
testcase_19 AC 67 ms
71,108 KB
testcase_20 AC 67 ms
71,272 KB
testcase_21 AC 67 ms
71,236 KB
testcase_22 AC 67 ms
71,088 KB
testcase_23 AC 66 ms
71,144 KB
権限があれば一括ダウンロードができます

ソースコード

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