結果
| 問題 | No.2278 Time Bomb Game 2 |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-08-05 21:32:50 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 2,000 ms |
| + 313µs | |
| コード長 | 1,032 bytes |
| 記録 | |
| コンパイル時間 | 886 ms |
| コンパイル使用メモリ | 95,856 KB |
| 実行使用メモリ | 83,712 KB |
| 最終ジャッジ日時 | 2026-08-05 21:32:59 |
| 合計ジャッジ時間 | 8,465 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 70 |
ソースコード
N, K, T = map(int, input().split())
C = input()
INF = 1<<60
K -= 1
S = C[K]
n = 0 if S == "A" else 1
l, r = 0, 0
fl, fr = False, False
idx = K-1
while 0 <= idx and C[idx] == S:
l += 1
idx -= 1
if idx == -1: fl = True
idx = K+1
while idx < N and C[idx] == S:
r += 1
idx += 1
if idx == N: fr = True
ans = ["Alice", "Bob"]
def funcL(start):
if start == -1: return INF
idx = start-1
while 0 <= idx and C[idx] == C[start]:
idx -= 1
return start-idx
def funcR(start):
if start == N: return INF
idx = start+1
while idx < N and C[idx] == C[start]:
idx += 1
return idx-start
if 1 <= l+r:
if l%2 != T%2 and l < T and not fl or r%2 != T%2 and r < T and not fr:
print(ans[n])
else:
print(ans[n^1])
else:
if T%2 == 1:
a, b = funcL(K-1), funcR(K+1)
if (a == INF or a%2 == 0 and a <= T-1) and (b == INF or b%2 == 0 and b <= T-1):
print(ans[n^1])
else:
print(ans[n])
else:
print(ans[n^1])
detteiuu