結果

問題 No.2278 Time Bomb Game 2
ユーザー ntudantuda
提出日時 2023-04-24 19:46:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 1,696 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 82,648 KB
実行使用メモリ 61,820 KB
最終ジャッジ日時 2024-04-26 07:02:30
合計ジャッジ時間 5,691 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
53,200 KB
testcase_01 AC 38 ms
52,904 KB
testcase_02 AC 39 ms
52,832 KB
testcase_03 AC 39 ms
53,376 KB
testcase_04 AC 39 ms
52,544 KB
testcase_05 AC 42 ms
53,700 KB
testcase_06 AC 45 ms
54,048 KB
testcase_07 AC 43 ms
53,400 KB
testcase_08 AC 41 ms
53,088 KB
testcase_09 AC 43 ms
54,672 KB
testcase_10 AC 50 ms
60,200 KB
testcase_11 AC 48 ms
60,696 KB
testcase_12 AC 45 ms
59,840 KB
testcase_13 AC 46 ms
61,180 KB
testcase_14 AC 45 ms
59,984 KB
testcase_15 AC 44 ms
60,280 KB
testcase_16 AC 45 ms
61,176 KB
testcase_17 AC 45 ms
60,324 KB
testcase_18 AC 46 ms
60,672 KB
testcase_19 AC 44 ms
61,820 KB
testcase_20 AC 40 ms
53,796 KB
testcase_21 AC 40 ms
54,304 KB
testcase_22 AC 40 ms
54,968 KB
testcase_23 AC 40 ms
54,904 KB
testcase_24 AC 39 ms
53,880 KB
testcase_25 AC 40 ms
54,712 KB
testcase_26 AC 40 ms
54,556 KB
testcase_27 AC 39 ms
54,740 KB
testcase_28 AC 38 ms
54,840 KB
testcase_29 AC 40 ms
54,232 KB
testcase_30 AC 40 ms
54,384 KB
testcase_31 AC 39 ms
54,312 KB
testcase_32 AC 38 ms
54,380 KB
testcase_33 AC 40 ms
54,616 KB
testcase_34 AC 37 ms
55,308 KB
testcase_35 AC 39 ms
54,656 KB
testcase_36 AC 40 ms
54,020 KB
testcase_37 AC 42 ms
60,152 KB
testcase_38 AC 43 ms
60,532 KB
testcase_39 AC 43 ms
60,324 KB
testcase_40 AC 43 ms
59,988 KB
testcase_41 AC 44 ms
60,600 KB
testcase_42 AC 45 ms
60,092 KB
testcase_43 AC 44 ms
59,556 KB
testcase_44 AC 44 ms
59,808 KB
testcase_45 AC 46 ms
60,352 KB
testcase_46 AC 44 ms
60,072 KB
testcase_47 AC 44 ms
60,928 KB
testcase_48 AC 43 ms
60,140 KB
testcase_49 AC 45 ms
59,772 KB
testcase_50 AC 40 ms
54,548 KB
testcase_51 AC 39 ms
55,308 KB
testcase_52 AC 39 ms
54,212 KB
testcase_53 AC 38 ms
53,928 KB
testcase_54 AC 38 ms
54,168 KB
testcase_55 AC 39 ms
53,868 KB
testcase_56 AC 40 ms
54,604 KB
testcase_57 AC 38 ms
53,520 KB
testcase_58 AC 40 ms
54,820 KB
testcase_59 AC 40 ms
54,408 KB
testcase_60 AC 40 ms
55,764 KB
testcase_61 AC 39 ms
54,328 KB
testcase_62 AC 40 ms
54,764 KB
testcase_63 AC 40 ms
54,468 KB
testcase_64 AC 44 ms
60,428 KB
testcase_65 AC 44 ms
61,080 KB
testcase_66 AC 44 ms
60,744 KB
testcase_67 AC 43 ms
59,524 KB
testcase_68 AC 43 ms
60,572 KB
testcase_69 AC 46 ms
60,748 KB
testcase_70 AC 44 ms
59,928 KB
testcase_71 AC 38 ms
53,636 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