結果

問題 No.683 Two Operations No.3
ユーザー AEnAEn
提出日時 2022-06-12 15:49:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 498 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 81,720 KB
実行使用メモリ 63,968 KB
最終ジャッジ日時 2023-10-24 11:45:19
合計ジャッジ時間 1,689 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,560 KB
testcase_01 AC 39 ms
53,512 KB
testcase_02 AC 39 ms
53,512 KB
testcase_03 AC 39 ms
53,512 KB
testcase_04 AC 50 ms
63,968 KB
testcase_05 AC 46 ms
61,756 KB
testcase_06 AC 40 ms
53,532 KB
testcase_07 AC 40 ms
55,580 KB
testcase_08 AC 40 ms
53,532 KB
testcase_09 AC 44 ms
61,560 KB
testcase_10 AC 40 ms
53,532 KB
testcase_11 AC 39 ms
53,532 KB
testcase_12 AC 40 ms
55,580 KB
testcase_13 AC 41 ms
55,580 KB
testcase_14 AC 40 ms
53,532 KB
testcase_15 AC 40 ms
55,580 KB
権限があれば一括ダウンロードができます

ソースコード

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 == 0 or 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