結果

問題 No.683 Two Operations No.3
ユーザー AEnAEn
提出日時 2022-06-12 15:44:39
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 493 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 66,036 KB
最終ジャッジ日時 2023-10-24 11:41:50
合計ジャッジ時間 4,087 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
55,696 KB
testcase_01 AC 38 ms
53,528 KB
testcase_02 AC 38 ms
53,528 KB
testcase_03 AC 38 ms
53,528 KB
testcase_04 AC 51 ms
66,036 KB
testcase_05 AC 47 ms
63,960 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

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