結果
| 問題 |
No.1465 Archaea
|
| コンテスト | |
| ユーザー |
wolgnik
|
| 提出日時 | 2020-07-28 13:41:28 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 260 ms / 2,000 ms |
| コード長 | 446 bytes |
| コンパイル時間 | 227 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 21,840 KB |
| 最終ジャッジ日時 | 2024-12-24 01:06:43 |
| 合計ジャッジ時間 | 3,175 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")
wolgnik