結果

問題 No.2278 Time Bomb Game 2
ユーザー gew1fw
提出日時 2025-06-12 14:48:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 714 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 82,880 KB
実行使用メモリ 61,508 KB
最終ジャッジ日時 2025-06-12 14:51:49
合計ジャッジ時間 4,969 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 67 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, t = map(int, input().split())
c = input().strip()
k -= 1  # Convert to 0-based index

current_char = c[k]

# Find minimal steps to reach a cell of opposite type
min_left = float('inf')
steps = 0
pos = k
while pos >= 0 and c[pos] == current_char:
    pos -= 1
    steps += 1
if pos >= 0 and c[pos] != current_char:
    min_left = steps

min_right = float('inf')
steps = 0
pos = k
while pos < n and c[pos] == current_char:
    pos += 1
    steps += 1
if pos < n and c[pos] != current_char:
    min_right = steps

min_steps = min(min_left, min_right)

if min_steps <= t and (t - min_steps) % 2 == 0:
    print("Alice" if current_char == 'A' else "Bob")
else:
    print("Bob" if current_char == 'A' else "Alice")
0