結果

問題 No.1465 Archaea
ユーザー wolgnikwolgnik
提出日時 2020-07-28 13:41:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 98,416 KB
最終ジャッジ日時 2023-08-25 16:06:57
合計ジャッジ時間 4,163 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,592 KB
testcase_01 AC 89 ms
71,636 KB
testcase_02 AC 90 ms
71,636 KB
testcase_03 AC 96 ms
71,772 KB
testcase_04 AC 92 ms
71,788 KB
testcase_05 AC 91 ms
71,888 KB
testcase_06 AC 91 ms
71,980 KB
testcase_07 AC 123 ms
81,836 KB
testcase_08 AC 93 ms
71,892 KB
testcase_09 AC 130 ms
84,872 KB
testcase_10 AC 92 ms
71,440 KB
testcase_11 AC 127 ms
83,248 KB
testcase_12 AC 100 ms
77,200 KB
testcase_13 AC 145 ms
92,304 KB
testcase_14 AC 126 ms
83,216 KB
testcase_15 AC 92 ms
71,472 KB
testcase_16 AC 100 ms
77,252 KB
testcase_17 AC 151 ms
94,200 KB
testcase_18 AC 113 ms
77,708 KB
testcase_19 AC 130 ms
84,868 KB
testcase_20 AC 143 ms
89,168 KB
testcase_21 AC 158 ms
98,220 KB
testcase_22 AC 158 ms
98,416 KB
testcase_23 AC 90 ms
71,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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")
0