結果

問題 No.683 Two Operations No.3
ユーザー prd_xxxprd_xxx
提出日時 2018-05-11 23:03:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 17,024 KB
最終ジャッジ日時 2023-09-10 18:45:10
合計ジャッジ時間 2,234 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
16,852 KB
testcase_01 AC 72 ms
16,816 KB
testcase_02 AC 72 ms
16,964 KB
testcase_03 AC 71 ms
16,948 KB
testcase_04 AC 70 ms
16,964 KB
testcase_05 AC 71 ms
17,024 KB
testcase_06 AC 71 ms
16,868 KB
testcase_07 AC 72 ms
16,868 KB
testcase_08 AC 70 ms
16,880 KB
testcase_09 AC 70 ms
16,872 KB
testcase_10 AC 70 ms
16,900 KB
testcase_11 AC 71 ms
16,892 KB
testcase_12 AC 71 ms
16,872 KB
testcase_13 AC 72 ms
17,000 KB
testcase_14 AC 72 ms
16,856 KB
testcase_15 AC 72 ms
17,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)

X,Y = map(int,input().split())
N = 1000
mem = [[None for i in range(N)] for j in range(N)]
def dfs(x,y):
    if x == 0 or y == 0: return True
    if x < 0 or y < 0: return False
    if x%2 and y%2: return False
    if x < N and y < N and mem[x][y] is not None:
        return mem[x][y]
    if x%2:
        ret = dfs(x-1,y//2)
    elif y%2:
        ret = dfs(x//2,y-1)
    else:
        ret = dfs(x-1,y//2) or dfs(x//2,y-1)
    if x < N and y < N:
        mem[x][y] = mem[y][x] = ret
    return ret

print('Yes' if dfs(X,Y) else 'No')
0