結果

問題 No.2278 Time Bomb Game 2
ユーザー minimum
提出日時 2023-04-21 22:14:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 764 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,496 KB
実行使用メモリ 66,340 KB
最終ジャッジ日時 2024-11-06 15:44:22
合計ジャッジ時間 5,322 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 65 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = float('inf')
N, K, T = map(int, input().split())
S = input()
if 'A' not in S:
    print("Bob")
if 'B' not in S:
    print("Alice")


def f(S, i):
    res = []
    lres = INF
    for l in range(i - 1, -1, -1):
        if S[l] != S[i]:
            lres = abs(l - i)
            break
    rres = INF
    for r in range(i, N):
        if S[r] != S[i]:
            rres = abs(r - i)
            break
    return min(lres, rres)


K -= 1

if S[K] == 'A':
    d = f(S, K)
    if T < d:
        print("Bob")
    else:
        if (T - d) % 2:
            print("Bob")
        else:
            print("Alice")
else:
    d = f(S, K)
    if T < d:
        print("Alice")
    else:
        if (T - d) % 2:
            print("Alice")
        else:
            print("Bob")
0