結果
| 問題 |
No.2103 ±1s Game
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 18:08:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,037 bytes |
| コンパイル時間 | 209 ms |
| コンパイル使用メモリ | 82,080 KB |
| 実行使用メモリ | 54,024 KB |
| 最終ジャッジ日時 | 2025-06-12 18:11:03 |
| 合計ジャッジ時間 | 2,754 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 8 |
ソースコード
X, Y, K, P = map(int, input().split())
T = X + Y - K
# Calculate the required parity R
R = (Y % 2) ^ (1 if P == -1 else 0)
t_min = max(0, T - X)
t_max = min(Y, T)
# Check if there's any t in [t_min, t_max] with t % 2 == R
has_solution = False
if t_max >= t_min:
first_t = t_min if t_min % 2 == R else t_min + 1
if first_t <= t_max:
has_solution = True
if not has_solution:
print("Bob")
else:
C = min(T, min(X, Y))
if X <= Y:
forced_flips = max(0, T - C)
else:
forced_flips = 0
# Determine if during C moves, all -1s or all +1s are taken
if C == Y:
flips_during_parity = Y % 2
elif C == X:
flips_during_parity = 0
else:
desired_parity = (R - forced_flips) % 2
if C % 2 == 0:
flips_during_parity = (1 - desired_parity) % 2
else:
flips_during_parity = desired_parity
total_parity = (forced_flips + flips_during_parity) % 2
if total_parity == R:
print("Alice")
else:
print("Bob")
gew1fw