結果

問題 No.683 Two Operations No.3
ユーザー ayaoniayaoni
提出日時 2021-01-03 23:05:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 825 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 55,936 KB
最終ジャッジ日時 2024-04-21 17:53:28
合計ジャッジ時間 1,939 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
55,424 KB
testcase_01 AC 59 ms
54,784 KB
testcase_02 AC 60 ms
54,912 KB
testcase_03 AC 55 ms
55,296 KB
testcase_04 AC 63 ms
55,936 KB
testcase_05 AC 62 ms
55,552 KB
testcase_06 AC 51 ms
54,528 KB
testcase_07 AC 56 ms
55,680 KB
testcase_08 AC 51 ms
55,040 KB
testcase_09 AC 54 ms
55,552 KB
testcase_10 AC 52 ms
54,528 KB
testcase_11 AC 51 ms
54,912 KB
testcase_12 AC 51 ms
55,168 KB
testcase_13 AC 52 ms
55,040 KB
testcase_14 AC 54 ms
54,784 KB
testcase_15 AC 54 ms
54,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from functools import lru_cache
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


A,B = MI()


@lru_cache(maxsize=None)
def f(X,Y):
    if X < 0 or Y < 0:
        return False
    if X % 2 == Y % 2 == 1:
        return False
    if X*Y == 0:
        return True
    if X % 2 == 0 and f(X//2,Y-1):
        return True
    if Y % 2 == 0 and f(X-1,Y//2):
        return True
    return False


print('Yes' if f(A,B) else 'No')
0