結果

問題 No.683 Two Operations No.3
ユーザー TsubajiroTsubajiro
提出日時 2022-05-16 22:07:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 686 bytes
コンパイル時間 951 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 8,664 KB
最終ジャッジ日時 2023-10-12 16:37:09
合計ジャッジ時間 1,820 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 19 ms
8,524 KB
testcase_02 AC 19 ms
8,564 KB
testcase_03 AC 19 ms
8,472 KB
testcase_04 AC 19 ms
8,664 KB
testcase_05 AC 19 ms
8,520 KB
testcase_06 AC 19 ms
8,576 KB
testcase_07 WA -
testcase_08 AC 20 ms
8,456 KB
testcase_09 AC 20 ms
8,580 KB
testcase_10 AC 19 ms
8,664 KB
testcase_11 WA -
testcase_12 AC 19 ms
8,580 KB
testcase_13 AC 18 ms
8,580 KB
testcase_14 WA -
testcase_15 AC 19 ms
8,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B = list(map(int, input().split()))
from collections import deque
que = deque()
que.append([A,B])
comb=set()
comb.add((A,B))
while que:
    a,b = que.popleft()
    if a==0 or b==0:
        print("Yes")
        exit()
    if a%2==b%2==0:
        if (a%2,b-1) not in comb:
            comb.add((a%2,b-1))
            que.append([a%2,b-1])
        if (a-1,b%2) not in comb:
            comb.add((a-1,b%2))
            que.append([a-1,b%2])
    elif a%2==0:
        if (a%2,b-1) not in comb:
            comb.add((a%2,b-1))
            que.append([a%2,b-1])
    elif b%2==0:
        if (a-1,b%2) not in comb:
            comb.add((a-1,b%2))
            que.append([a-1,b%2])

print("No")
0