結果

問題 No.683 Two Operations No.3
コンテスト
ユーザー nebukuro09
提出日時 2018-05-11 22:33:03
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
MLE  
実行時間 -
コード長 567 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,411 ms
コンパイル使用メモリ 80,524 KB
実行使用メモリ 1,261,024 KB
最終ジャッジ日時 2026-03-16 15:49:13
合計ジャッジ時間 20,867 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 TLE * 2 MLE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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