結果
| 問題 | No.683 Two Operations No.3 |
| コンテスト | |
| ユーザー |
nadare
|
| 提出日時 | 2018-05-11 23:31:04 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 630 bytes |
| 記録 | |
| コンパイル時間 | 222 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-06-28 09:56:40 |
| 合計ジャッジ時間 | 1,426 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())
A, B = inpl()
if A==0 and B==0:
print("Yes")
exit()
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 or 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 or nb == 0:
print("Yes")
break
if na >= 0: # and (not searched[(na, nb)])
Q.append([na, nb])
else:
print("No")
nadare