結果

問題 No.683 Two Operations No.3
ユーザー nebukuro09nebukuro09
提出日時 2018-05-11 22:34:55
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 566 bytes
コンパイル時間 2,385 ms
コンパイル使用メモリ 77,452 KB
実行使用メモリ 76,596 KB
最終ジャッジ日時 2023-09-10 18:43:32
合計ジャッジ時間 3,593 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
76,200 KB
testcase_01 AC 76 ms
76,312 KB
testcase_02 AC 75 ms
76,320 KB
testcase_03 AC 74 ms
76,080 KB
testcase_04 AC 73 ms
76,280 KB
testcase_05 AC 73 ms
76,568 KB
testcase_06 AC 73 ms
76,532 KB
testcase_07 AC 72 ms
76,324 KB
testcase_08 AC 71 ms
76,340 KB
testcase_09 AC 73 ms
76,364 KB
testcase_10 AC 71 ms
76,596 KB
testcase_11 AC 73 ms
76,292 KB
testcase_12 AC 73 ms
76,328 KB
testcase_13 AC 72 ms
76,352 KB
testcase_14 AC 72 ms
76,292 KB
testcase_15 AC 73 ms
76,368 KB
権限があれば一括ダウンロードができます

ソースコード

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 or 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