結果

問題 No.683 Two Operations No.3
ユーザー nadarenadare
提出日時 2018-05-11 23:27:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 7,824 KB
最終ジャッジ日時 2023-09-10 17:52:26
合計ジャッジ時間 4,368 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,824 KB
testcase_01 AC 15 ms
7,780 KB
testcase_02 AC 15 ms
7,760 KB
testcase_03 WA -
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

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