結果
問題 |
No.1465 Archaea
|
ユーザー |
![]() |
提出日時 | 2021-03-07 23:09:13 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 396 bytes |
コンパイル時間 | 339 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 52,608 KB |
最終ジャッジ日時 | 2024-12-24 01:06:37 |
合計ジャッジ時間 | 2,396 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
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")