結果

問題 No.1465 Archaea
ユーザー O2MTO2MT
提出日時 2021-04-15 22:03:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 79,116 KB
最終ジャッジ日時 2023-09-15 00:06:25
合計ジャッジ時間 3,691 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
71,376 KB
testcase_01 AC 86 ms
71,376 KB
testcase_02 AC 87 ms
71,844 KB
testcase_03 AC 89 ms
71,840 KB
testcase_04 AC 86 ms
71,888 KB
testcase_05 AC 88 ms
71,380 KB
testcase_06 AC 87 ms
71,864 KB
testcase_07 AC 107 ms
77,844 KB
testcase_08 AC 86 ms
71,536 KB
testcase_09 AC 112 ms
78,116 KB
testcase_10 AC 88 ms
71,580 KB
testcase_11 AC 108 ms
77,852 KB
testcase_12 AC 96 ms
77,092 KB
testcase_13 AC 116 ms
78,524 KB
testcase_14 AC 110 ms
77,776 KB
testcase_15 AC 90 ms
71,592 KB
testcase_16 AC 87 ms
71,536 KB
testcase_17 AC 114 ms
78,788 KB
testcase_18 AC 101 ms
77,504 KB
testcase_19 AC 92 ms
71,940 KB
testcase_20 AC 112 ms
78,460 KB
testcase_21 AC 118 ms
78,876 KB
testcase_22 AC 114 ms
79,116 KB
testcase_23 AC 86 ms
71,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N,K = map(int,input().split())
que = deque([(1, 0)]) # (細胞の数, 捜査回数)
visited = [True]*(N+1)
while que:
    num, count = que.popleft()
    if count > K:
        continue
    if num == N:
        print('YES')
        exit()
    a, b = num*2, num+3
    if a <= N and visited[a]:
        que.append((a,count+1))
        visited[a] = False
    if b <= N and visited[b]:
        que.append((b,count+1))
        visited[b] = False

print('NO')
0