結果
| 問題 |
No.1465 Archaea
|
| コンテスト | |
| ユーザー |
sgsw
|
| 提出日時 | 2021-05-05 19:33:06 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 957 bytes |
| コンパイル時間 | 251 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 352,416 KB |
| 最終ジャッジ日時 | 2024-09-13 12:27:18 |
| 合計ジャッジ時間 | 5,033 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 9 TLE * 1 -- * 10 |
ソースコード
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()
sgsw