結果
| 問題 |
No.2278 Time Bomb Game 2
|
| コンテスト | |
| ユーザー |
miscalc
|
| 提出日時 | 2023-04-21 11:21:07 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 72 ms / 2,000 ms |
| コード長 | 835 bytes |
| コンパイル時間 | 537 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 12,944 KB |
| 最終ジャッジ日時 | 2024-11-06 17:00:14 |
| 合計ジャッジ時間 | 5,903 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 70 |
ソースコード
def solve(n, k, t, s):
if s[k] == 'B':
s2 = "".join(['A' if s[i] == 'B' else 'B' for i in range(n)])
return not solve(n, k, t, s2)
if (k != 0 and s[k-1] == 'A') or (k != n-1 and s[k+1] == 'A'):
l, r = -1, -1
for i in range(k-1, -1, -1):
if s[i] == 'B':
l = i
break
for i in range(k+1, n):
if s[i] == 'B':
r = i
break
if l != -1 and k - l <= t and (k - l) % 2 == t % 2:
return True
if r != -1 and r - k <= t and (r - k) % 2 == t % 2:
return True
return False
else:
if t % 2 == 0:
return False
if k != 0 and solve(n, k-1, t-1, s):
return True
if k != n-1 and solve(n, k+1, t-1, s):
return True
return False
n, k, t = map(int, input().split())
s = input()
k -= 1
print("Alice" if solve(n, k, t, s) else "Bob")
miscalc