結果
| 問題 |
No.3112 Decrement or Mod Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-18 21:32:39 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 640 bytes |
| コンパイル時間 | 273 ms |
| コンパイル使用メモリ | 12,032 KB |
| 実行使用メモリ | 342,352 KB |
| 最終ジャッジ日時 | 2025-04-18 21:33:06 |
| 合計ジャッジ時間 | 6,744 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 64 |
ソースコード
import sys
sys.setrecursionlimit(10**6)
memo = {}
def win(a, b):
if a == 0:
return True # 自分が0になった → 勝ち
if b == 0:
return False # 相手が0で自分が非0 → 相手の勝ち
if (a, b) in memo:
return memo[(a, b)]
# 操作1: 1 減らす
if not win(b, a - 1):
memo[(a, b)] = True
return True
# 操作2: 余りに置き換える
if a >= b and not win(b, a % b):
memo[(a, b)] = True
return True
memo[(a, b)] = False
return False
# 入力
A, B = map(int, input().split())
# 出力
print("Alice" if win(A, B) else "Bob")