結果

問題 No.683 Two Operations No.3
ユーザー nadare
提出日時 2018-05-11 23:27:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-06-28 09:03:26
合計ジャッジ時間 3,726 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 1 TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())

A, B = inpl()
Q = [[A, B]]

c = 0
while Q:
    c += 1
    a, b = Q.pop()
    if a%2==0:
        na, nb = a//2, b-1
        if na == 0 and nb == 0:
            print("Yes")
            break
        
        if nb >= 0: # and (not searched[(na, nb)])
            Q.append([na, nb])
    
    if b%2==0:
        na, nb = a-1, b//2
        if na == 0 and nb == 0:
            print("Yes")
            break
        
        if na >= 0: # and (not searched[(na, nb)])
            Q.append([na, nb])

else:
    print("No")
0