結果

問題 No.683 Two Operations No.3
ユーザー nebukuro09nebukuro09
提出日時 2018-05-11 22:33:03
言語 PyPy2
(7.3.15)
結果
MLE  
実行時間 -
コード長 567 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 77,404 KB
実行使用メモリ 780,536 KB
最終ジャッジ日時 2023-09-10 13:05:04
合計ジャッジ時間 4,441 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
80,516 KB
testcase_01 AC 78 ms
76,180 KB
testcase_02 AC 75 ms
76,372 KB
testcase_03 AC 75 ms
76,192 KB
testcase_04 MLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b = map(int, raw_input().split())

stack = [(a, b)]
d = set()
while len(stack) > 0:
    x, y = stack[-1]
    stack.pop()
    if x == 0 and y == 0:
        print "Yes"
        exit()
    if (x, y) in d:
        continue
    if x % 2 == 1 and y % 2 == 1:
        continue
    d.add((x, y))
    if y > 0 and x % 2 == 0:
        xx = x / 2
        yy = y - 1
        if (xx, yy) not in d:
            stack.append((xx, yy))
    if x > 0 and y % 2 == 0:
        xx = x - 1
        yy = y / 2
        if (xx, yy) not in d:
            stack.append((xx, yy))

print "No"
0