結果
問題 |
No.1465 Archaea
|
ユーザー |
![]() |
提出日時 | 2020-07-28 13:41:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 136 ms / 2,000 ms |
コード長 | 446 bytes |
コンパイル時間 | 186 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 90,752 KB |
最終ジャッジ日時 | 2024-12-24 01:06:46 |
合計ジャッジ時間 | 2,947 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
import sys from collections import deque as dq from collections import defaultdict as dd input = sys.stdin.readline N, K = map(int, input().split()) Q = dq([1]) d = dd(lambda: 10 ** 10) d[1] = 0 while len(Q): x = Q.popleft() if x + 3 <= N and (d[x + 3] > d[x] + 1): d[x + 3] = d[x] + 1 Q.append(x + 3) if x * 2 <= N and (d[x * 2] > d[x] + 1): d[x * 2] = d[x] + 1 Q.append(x * 2) if d[N] <= K: print("YES") else: print("NO")