結果
問題 | No.683 Two Operations No.3 |
ユーザー | mkawa2 |
提出日時 | 2020-01-22 21:24:35 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 499 bytes |
コンパイル時間 | 259 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-16 02:05:03 |
合計ジャッジ時間 | 1,674 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
ソースコード
import sys sys.setrecursionlimit(10 ** 6) def MI(): return map(int, sys.stdin.readline().split()) def main(): memo={} def ok(a, b): if a * b == 0: return True if a > b: a, b = b, a if (a,b) in memo:return memo[a,b] res = False if a % 2 == 0: res |= ok(a // 2, b - 1) if b % 2 == 0: res |= ok(a - 1, b // 2) memo[a,b]=res return res a, b = MI() if ok(a, b): print("Yes") else: print("No") main()