結果
問題 |
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 1 s_min = max(0, K - X) s_max = min(Y, K) # Check if there's any s in [s_min, s_max] with parity d has_d_parity = False # The minimum and maximum possible s values. If any of them or any in between has parity d. low = s_min high = s_max if low > high: has_d_parity = False else: if low % 2 == d or high % 2 == d: has_d_parity = True else: # Check if there are elements with parity d between low and high if low < high: has_d_parity = True if not has_d_parity: print("Bob") exit() r = (Y - d) % 2 M = X + Y - K a_min = max(0, M - X) a_max = min(Y, M) # Check if there exists a in [a_min, a_max] with parity r valid_r = False if a_min > a_max: valid_r = False else: # Check a_min and a_max first if a_min % 2 == r or a_max % 2 == r: valid_r = True else: # 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 = True if 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 = False if a_min <= a_max: # Check a_min and a_max first if a_min % 2 == (r ^ 1) or a_max % 2 == (r ^ 1): valid_opposite = True else: # Check if there are any elements in between if a_min < a_max: valid_opposite = (a_min % 2 != a_max % 2) if valid_opposite: print("Bob") else: print("Alice")