結果

問題 No.2278 Time Bomb Game 2
ユーザー ntudantuda
提出日時 2023-04-24 19:46:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 1,696 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 60,032 KB
最終ジャッジ日時 2024-11-08 20:01:00
合計ジャッジ時間 6,527 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
52,480 KB
testcase_01 AC 43 ms
52,480 KB
testcase_02 AC 41 ms
52,224 KB
testcase_03 AC 42 ms
52,480 KB
testcase_04 AC 45 ms
52,224 KB
testcase_05 AC 42 ms
52,480 KB
testcase_06 AC 44 ms
52,480 KB
testcase_07 AC 42 ms
52,864 KB
testcase_08 AC 42 ms
52,736 KB
testcase_09 AC 44 ms
53,376 KB
testcase_10 AC 48 ms
59,264 KB
testcase_11 AC 49 ms
59,776 KB
testcase_12 AC 49 ms
59,136 KB
testcase_13 AC 50 ms
60,032 KB
testcase_14 AC 50 ms
59,904 KB
testcase_15 AC 48 ms
59,392 KB
testcase_16 AC 49 ms
59,520 KB
testcase_17 AC 49 ms
59,648 KB
testcase_18 AC 48 ms
59,648 KB
testcase_19 AC 49 ms
59,776 KB
testcase_20 AC 43 ms
53,632 KB
testcase_21 AC 43 ms
53,376 KB
testcase_22 AC 43 ms
53,376 KB
testcase_23 AC 43 ms
53,504 KB
testcase_24 AC 44 ms
53,504 KB
testcase_25 AC 43 ms
53,120 KB
testcase_26 AC 98 ms
53,248 KB
testcase_27 AC 44 ms
53,376 KB
testcase_28 AC 42 ms
53,120 KB
testcase_29 AC 43 ms
53,632 KB
testcase_30 AC 44 ms
53,504 KB
testcase_31 AC 44 ms
53,632 KB
testcase_32 AC 43 ms
53,376 KB
testcase_33 AC 43 ms
53,248 KB
testcase_34 AC 43 ms
53,376 KB
testcase_35 AC 44 ms
53,632 KB
testcase_36 AC 44 ms
53,376 KB
testcase_37 AC 49 ms
59,392 KB
testcase_38 AC 48 ms
59,008 KB
testcase_39 AC 48 ms
59,392 KB
testcase_40 AC 48 ms
59,008 KB
testcase_41 AC 48 ms
59,392 KB
testcase_42 AC 50 ms
59,008 KB
testcase_43 AC 48 ms
59,008 KB
testcase_44 AC 50 ms
59,392 KB
testcase_45 AC 49 ms
58,880 KB
testcase_46 AC 48 ms
59,008 KB
testcase_47 AC 47 ms
59,136 KB
testcase_48 AC 48 ms
58,880 KB
testcase_49 AC 47 ms
59,136 KB
testcase_50 AC 43 ms
53,504 KB
testcase_51 AC 43 ms
53,376 KB
testcase_52 AC 44 ms
53,248 KB
testcase_53 AC 44 ms
53,504 KB
testcase_54 AC 43 ms
53,504 KB
testcase_55 AC 43 ms
53,120 KB
testcase_56 AC 43 ms
53,376 KB
testcase_57 AC 44 ms
53,120 KB
testcase_58 AC 44 ms
53,632 KB
testcase_59 AC 43 ms
53,632 KB
testcase_60 AC 42 ms
53,120 KB
testcase_61 AC 43 ms
53,120 KB
testcase_62 AC 44 ms
53,120 KB
testcase_63 AC 43 ms
53,632 KB
testcase_64 AC 49 ms
60,032 KB
testcase_65 AC 49 ms
58,880 KB
testcase_66 AC 49 ms
58,880 KB
testcase_67 AC 49 ms
59,136 KB
testcase_68 AC 49 ms
59,008 KB
testcase_69 AC 49 ms
58,880 KB
testcase_70 AC 50 ms
59,008 KB
testcase_71 AC 43 ms
52,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,T = map(int,input().split())
C = input()
K -= 1
dic = {"A":"Alice","B":"Bob"}
now = C[K]
other = ["A","B"][now == "A"]
INF = 10 ** 10
R = L = INF

def cnt(start,dir,col):
    k = 0
    flag = 0
    ret = INF
    while 0 <= start + dir * (k + 1) < N:
        if C[start + dir * (k + 1)] != col:
            flag = 1
            ret = k
            break
        k += 1
    return ret

def out(x):
    print(dic[x])
    exit()

R = cnt(K,1,now)
L = cnt(K,-1,now)

if T <= L and T <= R:
    out(other)
if 0 < L < INF:
    if (L-T) % 2 == 1:
        out(now)
if 0 < R < INF:
    if (R-T) % 2 == 1:
        out(now)
# case, R == 0 or L == 0
if T % 2 == 1:
    if R == 0:
        R2 = cnt(K+1,1,other)
        if R2 % 2 == 0:
            out(now)
    if L == 0:
        L2 = cnt(K-1,-1,other)
        if L2 % 2 == 0:
            out(now)

out(other)
N,K,T = map(int,input().split())
C = input()
K -= 1
dic = {"A":"Alice","B":"Bob"}
now = C[K]
other = ["A","B"][now == "A"]
INF = 10 ** 10
R = L = INF

def cnt(start,dir,col):
    k = 0
    flag = 0
    ret = INF
    while 0 <= start + dir * (k + 1) < N:
        if C[start + dir * (k + 1)] != col:
            flag = 1
            ret = k
            break
        k += 1
    return ret

def out(x):
    print(dic[x])
    exit()

R = cnt(K,1,now)
L = cnt(K,-1,now)

if T <= L and T <= R:
    out(other)
if 0 < L < INF:
    if (L-T) % 2 == 1:
        out(now)
if 0 < R < INF:
    if (R-T) % 2 == 1:
        out(now)
# case, R == 0 or L == 0
if T % 2 == 1:
    if R == 0:
        R2 = cnt(K+1,1,other)
        if R2 % 2 == 0:
            out(now)
    if L == 0:
        L2 = cnt(K-1,-1,other)
        if L2 % 2 == 0:
            out(now)

out(other)
0