結果

問題 No.683 Two Operations No.3
ユーザー AEn
提出日時 2022-06-12 15:44:39
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 493 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 82,084 KB
実行使用メモリ 288,100 KB
最終ジャッジ日時 2024-09-23 04:00:24
合計ジャッジ時間 3,980 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

A, B = map(int, input().split())

d = deque()
d.append((A, B))

while d:
    a, b = d.popleft()
    if a == b == 0:
        exit(print('Yes'))
    if a%2==0 and b%2==1:
        p, q = a//2, b-1
        d.append((p, q))
    elif a%2==1 and b%2==0:
        p, q = a-1, b//2
        d.append((p,q))
    elif a%2==0 and b%2==0:
        p, q = a//2, b-1
        d.append((p, q))
        p, q = a-1, b//2
        d.append((p, q))
    else:
        continue
print('No')
0