結果
| 問題 | No.683 Two Operations No.3 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-05-11 22:31:52 | 
| 言語 | Python2 (2.7.18) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 547 bytes | 
| コンパイル時間 | 721 ms | 
| コンパイル使用メモリ | 7,072 KB | 
| 実行使用メモリ | 340,364 KB | 
| 最終ジャッジ日時 | 2024-06-28 04:32:54 | 
| 合計ジャッジ時間 | 4,221 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 4 TLE * 1 -- * 11 | 
ソースコード
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 x % 2 == 0:
        xx = x / 2
        yy = y - 1
        if (xx, yy) not in d:
            stack.append((xx, yy))
    if y % 2 == 0:
        xx = x - 1
        yy = y / 2
        if (xx, yy) not in d:
            stack.append((xx, yy))
print "No"
            
            
            
        