結果
| 問題 |
No.2278 Time Bomb Game 2
|
| コンテスト | |
| ユーザー |
shobonvip
|
| 提出日時 | 2023-04-21 22:21:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,157 bytes |
| コンパイル時間 | 262 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 76,800 KB |
| 最終ジャッジ日時 | 2024-11-06 17:05:21 |
| 合計ジャッジ時間 | 6,156 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 69 WA * 1 |
ソースコード
n,k,t = map(int,input().split())
c = input()
# 片方しかない
if 'A' not in c:
print("Alice")
exit()
if 'B' not in c:
print("Bob")
exit()
# 長さ偶数に到達させてはならない
rl = []
moji = ""
cnt = 0
for i in range(n):
if moji != c[i]:
if cnt > 0:
rl.append((moji,cnt))
cnt = 1
moji = c[i]
else:
cnt += 1
if cnt > 0:
rl.append((moji, cnt))
m = len(rl)
v = 0
ind = -1
indi = -1
for i in range(m):
v += rl[i][1]
if v >= k:
v -= rl[i][1]
indi = i
ind = k-v-1
break
mindist = 10 ** 9
if indi >= 1:
mindist = min(mindist, ind + 1)
if indi < m-1:
mindist = min(mindist, rl[indi][1] - ind)
# 到達不能!
if mindist > t:
if rl[indi][0] == "A":
print("Bob")
else:
print("Alice")
exit()
if indi >= 1:
# 左側でしめれる
if ind + 1 <= t and (t-(ind+1)) % 2 == 0:
if rl[indi][0] == "A":
print("Alice")
else:
print("Bob")
exit()
if indi < m-1:
# 右側でしめれる
if rl[indi][1] - ind <= t and (t-(rl[indi][1] - ind)) % 2 == 0:
if rl[indi][0] == "A":
print("Alice")
else:
print("Bob")
exit()
# 無理
if rl[indi][0] == "A":
print("Bob")
else:
print("Alice")
exit()
shobonvip