結果

問題 No.2278 Time Bomb Game 2
ユーザー tamatotamato
提出日時 2023-04-21 22:15:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,591 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 89,728 KB
最終ジャッジ日時 2024-04-24 08:22:19
合計ジャッジ時間 6,404 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,712 KB
testcase_01 AC 41 ms
51,712 KB
testcase_02 AC 41 ms
51,968 KB
testcase_03 AC 41 ms
52,096 KB
testcase_04 AC 41 ms
52,352 KB
testcase_05 AC 41 ms
51,712 KB
testcase_06 AC 53 ms
66,176 KB
testcase_07 AC 69 ms
79,232 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 48 ms
59,520 KB
testcase_11 AC 80 ms
89,728 KB
testcase_12 AC 67 ms
75,136 KB
testcase_13 AC 49 ms
59,136 KB
testcase_14 AC 82 ms
89,472 KB
testcase_15 AC 48 ms
59,392 KB
testcase_16 AC 48 ms
59,392 KB
testcase_17 AC 81 ms
89,600 KB
testcase_18 AC 49 ms
59,776 KB
testcase_19 AC 80 ms
89,472 KB
testcase_20 AC 74 ms
87,040 KB
testcase_21 AC 43 ms
53,760 KB
testcase_22 AC 69 ms
77,696 KB
testcase_23 AC 42 ms
53,632 KB
testcase_24 AC 43 ms
52,992 KB
testcase_25 AC 74 ms
87,296 KB
testcase_26 AC 73 ms
87,296 KB
testcase_27 AC 74 ms
87,168 KB
testcase_28 AC 76 ms
87,168 KB
testcase_29 AC 74 ms
87,168 KB
testcase_30 AC 73 ms
82,560 KB
testcase_31 AC 43 ms
53,248 KB
testcase_32 AC 42 ms
53,504 KB
testcase_33 AC 43 ms
53,248 KB
testcase_34 AC 75 ms
86,784 KB
testcase_35 AC 75 ms
87,296 KB
testcase_36 AC 44 ms
53,376 KB
testcase_37 AC 76 ms
87,424 KB
testcase_38 AC 75 ms
82,816 KB
testcase_39 AC 47 ms
59,264 KB
testcase_40 AC 71 ms
75,904 KB
testcase_41 AC 47 ms
59,136 KB
testcase_42 AC 65 ms
74,624 KB
testcase_43 AC 76 ms
87,552 KB
testcase_44 AC 48 ms
59,392 KB
testcase_45 AC 77 ms
88,064 KB
testcase_46 AC 72 ms
77,312 KB
testcase_47 AC 47 ms
59,136 KB
testcase_48 AC 47 ms
59,008 KB
testcase_49 AC 75 ms
83,840 KB
testcase_50 AC 76 ms
87,168 KB
testcase_51 AC 77 ms
87,552 KB
testcase_52 AC 44 ms
53,632 KB
testcase_53 AC 43 ms
53,376 KB
testcase_54 AC 43 ms
53,504 KB
testcase_55 AC 43 ms
53,120 KB
testcase_56 AC 72 ms
86,912 KB
testcase_57 AC 42 ms
53,248 KB
testcase_58 AC 74 ms
87,040 KB
testcase_59 AC 43 ms
53,248 KB
testcase_60 AC 76 ms
87,424 KB
testcase_61 AC 74 ms
87,040 KB
testcase_62 AC 43 ms
53,504 KB
testcase_63 AC 63 ms
74,240 KB
testcase_64 AC 75 ms
83,712 KB
testcase_65 AC 78 ms
87,808 KB
testcase_66 AC 86 ms
87,552 KB
testcase_67 AC 49 ms
59,392 KB
testcase_68 AC 77 ms
87,808 KB
testcase_69 AC 50 ms
58,880 KB
testcase_70 AC 49 ms
58,880 KB
testcase_71 AC 42 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
mod = 998244353

N, K, T = map(int, input().split())
C = input().rstrip('\n')

K -= 1
flg = 0
if C[K] == "B":
    C_new = []
    for c in C:
        if c == "A":
            C_new.append("B")
        else:
            C_new.append("A")
    C = "".join(C_new)
    flg = 1
C = C[max(0, K - T): min(N, K + T + 1)]
K = min(K, T)

exist_adj = 0
if K:
    if C[K - 1] == "A":
        exist_adj = 1
if K + 1 < len(C):
    if C[K + 1] == "A":
        exist_adj = 1

if not exist_adj:
    if K & 1 == (K - T) & 1:
        ans = 0
    else:
        if K == 1:
            ans = 1
        else:
            ans = 1
            # left
            if K - 2 >= 0:
                if C[K - 2] == "B":
                    for i in range(K - 3, -1, -1):
                        if C[i] == "A":
                            if i & 1 == (K - T) & 1:
                                ans = 0
            # right
            if K + 2 < len(C):
                if C[K + 2] == "B":
                    for i in range(K + 3, len(C)):
                        if C[i] == "A":
                            if i & 1 == (K - T) & 1:
                                ans = 0
else:
    ok = 0
    for i in range(K - 1, -1, -1):
        if C[i] == "B":
            if i & 1 == (K - T) & 1:
                ok = 1
            break
    for i in range(K, len(C)):
        if C[i] == "B":
            if i & 1 == (K - T) & 1:
                ok = 1
            break
    if ok:
        ans = 1
    else:
        ans = 0

if flg:
    ans ^= 1
if ans:
    print("Alice")
else:
    print("Bob")
0