結果

問題 No.1465 Archaea
ユーザー sgswsgsw
提出日時 2021-05-05 19:33:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 957 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 49,724 KB
最終ジャッジ日時 2023-10-11 13:44:27
合計ジャッジ時間 4,991 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,984 KB
testcase_01 AC 16 ms
7,796 KB
testcase_02 AC 28 ms
10,228 KB
testcase_03 AC 16 ms
7,844 KB
testcase_04 AC 16 ms
7,836 KB
testcase_05 AC 15 ms
7,896 KB
testcase_06 AC 16 ms
7,788 KB
testcase_07 AC 275 ms
42,352 KB
testcase_08 AC 20 ms
8,904 KB
testcase_09 AC 24 ms
9,424 KB
testcase_10 AC 16 ms
7,784 KB
testcase_11 AC 345 ms
49,724 KB
testcase_12 AC 106 ms
25,156 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

def input():
    return sys.stdin.readline().rstrip()

"""
Do not get stuck on a problem for more than 20 minutes
Just check the editorial :)
There should be something else to do insead
"""
memo = dict()
sys.setrecursionlimit(10000000)
def possible(N,K):
    if (N,K) in memo:
        return memo[(N,K)]
    if N == 1 and K >= 0:
        res = True
        memo[(N,K)] = res
        return res
    if N <= 0:
        return False
    if K == 0:
        res = bool(N == 1)
        memo[(N,K)] = res
        return res 
    #N > 0 K > 0
    if N % 2 == 0:
        res = possible(N//2,K - 1) | possible(N - 3,K - 1)
    else:
        res = possible(N - 3,K - 1)
    memo[(N,K)] = res 
    return res
    
def slv():
    n,k = map(int,input().split())
    if possible(n,k):
        print("YES")
    else:
        print("NO")
    return 

def main():
    t = 1
    for i in range(t):
        slv()
    return 


if __name__ == "__main__":
    main()
0