結果
| 問題 | No.683 Two Operations No.3 | 
| コンテスト | |
| ユーザー |  gew1fw | 
| 提出日時 | 2025-06-12 16:36:12 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                MLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 996 bytes | 
| コンパイル時間 | 194 ms | 
| コンパイル使用メモリ | 82,192 KB | 
| 実行使用メモリ | 596,660 KB | 
| 最終ジャッジ日時 | 2025-06-12 16:36:17 | 
| 合計ジャッジ時間 | 4,091 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 MLE * 1 -- * 9 | 
ソースコード
from collections import deque
def can_reach(A, B):
    visited = set()
    queue = deque()
    queue.append((A, B))
    visited.add((A, B))
    
    while queue:
        x, y = queue.popleft()
        
        if x == 0 and y == 0:
            return True
        
        # 尝试操作1的逆操作:X是偶数并且Y >=1
        if x % 2 == 0 and y >= 1:
            new_x = x // 2
            new_y = y - 1
            if (new_x, new_y) not in visited:
                visited.add((new_x, new_y))
                queue.append((new_x, new_y))
        
        # 尝试操作2的逆操作:Y是偶数并且X >=1
        if y % 2 == 0 and x >= 1:
            new_x = x - 1
            new_y = y // 2
            if (new_x, new_y) not in visited:
                visited.add((new_x, new_y))
                queue.append((new_x, new_y))
    
    return False
# 读取输入
A, B = map(int, input().split())
# 判断是否可以到达
if can_reach(A, B):
    print("Yes")
else:
    print("No")
            
            
            
        