結果
問題 | No.2103 ±1s Game |
ユーザー |
![]() |
提出日時 | 2025-03-20 20:38:21 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,735 bytes |
コンパイル時間 | 214 ms |
コンパイル使用メモリ | 82,280 KB |
実行使用メモリ | 54,552 KB |
最終ジャッジ日時 | 2025-03-20 20:38:46 |
合計ジャッジ時間 | 2,735 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 10 |
ソースコード
X, Y, K, P = map(int, input().split())d = 0 if P == 1 else 1s_min = max(0, K - X)s_max = min(Y, K)# Check if there's any s in [s_min, s_max] with parity dhas_d_parity = False# The minimum and maximum possible s values. If any of them or any in between has parity d.low = s_minhigh = s_maxif low > high:has_d_parity = Falseelse:if low % 2 == d or high % 2 == d:has_d_parity = Trueelse:# Check if there are elements with parity d between low and highif low < high:has_d_parity = Trueif not has_d_parity:print("Bob")exit()r = (Y - d) % 2M = X + Y - Ka_min = max(0, M - X)a_max = min(Y, M)# Check if there exists a in [a_min, a_max] with parity rvalid_r = Falseif a_min > a_max:valid_r = Falseelse:# Check a_min and a_max firstif a_min % 2 == r or a_max % 2 == r:valid_r = Trueelse:# If there's at least one a between a_min and a_max with parity r# The difference between a_min and a_max >=1 and they have different parities# then there's a a with parity r in between.if a_min < a_max:valid_r = Trueif not valid_r:print("Bob")exit()if M % 2 == 1:print("Alice")else:# Check if there exists a in [a_min, a_max] with parity (r ^ 1)valid_opposite = Falseif a_min <= a_max:# Check a_min and a_max firstif a_min % 2 == (r ^ 1) or a_max % 2 == (r ^ 1):valid_opposite = Trueelse:# Check if there are any elements in betweenif a_min < a_max:valid_opposite = (a_min % 2 != a_max % 2)if valid_opposite:print("Bob")else:print("Alice")