結果
問題 |
No.683 Two Operations No.3
|
ユーザー |
|
提出日時 | 2025-10-04 02:05:47 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 976 bytes |
コンパイル時間 | 424 ms |
コンパイル使用メモリ | 82,604 KB |
実行使用メモリ | 512,996 KB |
最終ジャッジ日時 | 2025-10-04 02:05:51 |
合計ジャッジ時間 | 4,578 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 MLE * 1 -- * 11 |
ソースコード
## https://yukicoder.me/problems/no/683 from collections import deque def main(): A, B = map(int, input().split()) if A == 0 or B == 0: print("Yes") return a_set = {(A, B)} queue = deque() queue.append((A, B)) while len(queue) > 0: x, y = queue.popleft() if x % 2 == 0 and y > 0: new_x = x // 2 new_y = y - 1 if new_x <= A and new_y <= B: if (new_x, new_y) not in a_set: a_set.add((new_x, new_y)) queue.append((new_x, new_y)) if x > 0 and y % 2 == 0: new_x = x - 1 new_y = y // 2 if new_x <= A and new_y <= B: if (new_x, new_y) not in a_set: a_set.add((new_x, new_y)) queue.append((new_x, new_y)) if (0, 0) in a_set: print("Yes") else: print("No") if __name__ == "__main__": main()