結果

問題 No.1465 Archaea
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-04-02 21:58:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 458 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 10,620 KB
実行使用メモリ 383,944 KB
最終ジャッジ日時 2023-08-25 12:09:09
合計ジャッジ時間 4,856 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,332 KB
testcase_01 AC 17 ms
7,792 KB
testcase_02 AC 31 ms
10,104 KB
testcase_03 AC 16 ms
7,960 KB
testcase_04 AC 16 ms
7,824 KB
testcase_05 AC 15 ms
7,852 KB
testcase_06 AC 16 ms
7,900 KB
testcase_07 AC 272 ms
41,992 KB
testcase_08 AC 19 ms
8,936 KB
testcase_09 AC 23 ms
9,232 KB
testcase_10 AC 15 ms
7,824 KB
testcase_11 AC 353 ms
49,512 KB
testcase_12 AC 111 ms
25,028 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**6)
n,k = map(int,input().split())
dic = {}
def dfs(x,left):
    if (x,left) in dic:
        return dic[(x,left)]
    #print(x,left)
    if x < 1:
        return 0
    if x == 1:
        return 1
    if left == 0 and x != 1:
        return 0

    check = 0
    if x%2 == 0:
        check |= dfs(x//2,left-1)
    check |= dfs(x-3,left-1)

    dic[(x,left)] = check

    return check
print("YES" if dfs(n,k) else "NO")

    
0