結果

問題 No.2278 Time Bomb Game 2
ユーザー shotoyooshotoyoo
提出日時 2023-04-21 22:13:37
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,942 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 89,984 KB
最終ジャッジ日時 2024-04-24 09:37:26
合計ジャッジ時間 6,437 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
54,912 KB
testcase_01 AC 42 ms
54,528 KB
testcase_02 AC 43 ms
54,784 KB
testcase_03 AC 40 ms
54,528 KB
testcase_04 AC 42 ms
54,528 KB
testcase_05 AC 44 ms
54,656 KB
testcase_06 AC 52 ms
66,304 KB
testcase_07 AC 66 ms
78,720 KB
testcase_08 AC 60 ms
74,112 KB
testcase_09 AC 79 ms
86,272 KB
testcase_10 AC 79 ms
83,712 KB
testcase_11 AC 69 ms
81,024 KB
testcase_12 AC 58 ms
73,088 KB
testcase_13 AC 81 ms
85,956 KB
testcase_14 AC 71 ms
82,816 KB
testcase_15 AC 79 ms
85,144 KB
testcase_16 AC 67 ms
79,904 KB
testcase_17 AC 64 ms
75,392 KB
testcase_18 AC 67 ms
80,512 KB
testcase_19 AC 67 ms
80,516 KB
testcase_20 AC 60 ms
74,368 KB
testcase_21 AC 55 ms
72,064 KB
testcase_22 AC 57 ms
73,088 KB
testcase_23 AC 69 ms
82,816 KB
testcase_24 AC 80 ms
87,936 KB
testcase_25 AC 69 ms
82,080 KB
testcase_26 AC 67 ms
80,896 KB
testcase_27 AC 82 ms
86,492 KB
testcase_28 AC 64 ms
77,312 KB
testcase_29 AC 68 ms
82,048 KB
testcase_30 AC 67 ms
80,512 KB
testcase_31 AC 61 ms
74,752 KB
testcase_32 AC 65 ms
78,976 KB
testcase_33 AC 67 ms
79,616 KB
testcase_34 AC 68 ms
82,816 KB
testcase_35 AC 82 ms
86,784 KB
testcase_36 AC 64 ms
78,464 KB
testcase_37 AC 66 ms
79,616 KB
testcase_38 AC 67 ms
78,976 KB
testcase_39 AC 82 ms
89,984 KB
testcase_40 AC 62 ms
73,856 KB
testcase_41 AC 70 ms
82,048 KB
testcase_42 AC 57 ms
71,680 KB
testcase_43 AC 67 ms
80,768 KB
testcase_44 AC 59 ms
73,472 KB
testcase_45 AC 62 ms
77,056 KB
testcase_46 AC 62 ms
74,752 KB
testcase_47 AC 78 ms
84,352 KB
testcase_48 AC 84 ms
86,756 KB
testcase_49 AC 69 ms
80,896 KB
testcase_50 AC 61 ms
75,264 KB
testcase_51 AC 67 ms
81,580 KB
testcase_52 AC 60 ms
73,216 KB
testcase_53 AC 65 ms
81,280 KB
testcase_54 AC 59 ms
74,240 KB
testcase_55 AC 62 ms
76,288 KB
testcase_56 AC 56 ms
71,424 KB
testcase_57 AC 65 ms
78,720 KB
testcase_58 AC 59 ms
73,216 KB
testcase_59 AC 68 ms
83,072 KB
testcase_60 AC 69 ms
82,744 KB
testcase_61 AC 58 ms
75,008 KB
testcase_62 AC 69 ms
83,616 KB
testcase_63 AC 59 ms
73,088 KB
testcase_64 AC 60 ms
73,472 KB
testcase_65 AC 58 ms
72,704 KB
testcase_66 AC 64 ms
73,472 KB
testcase_67 AC 58 ms
72,704 KB
testcase_68 AC 58 ms
72,448 KB
testcase_69 AC 58 ms
73,088 KB
testcase_70 AC 56 ms
71,808 KB
testcase_71 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, random
input = lambda : sys.stdin.readline().rstrip()


write = lambda x: sys.stdout.write(x+"\n"); writef = lambda x: print("{:.12f}".format(x))
debug = lambda x: sys.stderr.write(x+"\n")
YES="Yes"; NO="No"; pans = lambda v: print(YES if v else NO); INF=10**18
LI = lambda : list(map(int, input().split())); II=lambda : int(input()); SI=lambda : [ord(c)-ord("a") for c in input()]
def debug(_l_):
    for s in _l_.split():
        print(f"{s}={eval(s)}", end=" ")
    print()
def dlist(*l, fill=0):
    if len(l)==1:
        return [fill]*l[0]
    ll = l[1:]
    return [dlist(*ll, fill=fill) for _ in range(l[0])]

def runlength(s):
    if not s:
        return []
    c = s[0]
    v = 1
    n = len(s)
    l = []
    for i in range(1, n):
        if c==s[i]:
            v += 1
        else:
            l.append((c,v))
            c = s[i]
            v = 1
    l.append((c,v))
    return l

n,k,t = list(map(int, input().split()))
k -= 1
c = input()
c = [cc=="A" for cc in c]
res = runlength(c)
f = c[k]
def sub(index):
    i0 = i1 = INF
    for i in index:
        if c[i]==f:
            if i0==INF:
                continue
            else:
                i1 = i
                break
        else:
            if i0==INF:
                i0 = i
    return i0,i1
i0,i1 = sub(list(range(k,n)))
j0,j1 = sub(list(range(k+1))[::-1])
if j0==INF:
    l = 0
else:
    l = j0+1
r = min(i0,n)
d = r-l
if d>=2:
    if i0<INF and t>=abs(k-i0) and (t+k+i0)%2==0:
        res = 1
    elif j0!=INF and t>=abs(k-j0) and (t+k+j0)%2==0:
        res = 1
    else:
        res = 0
else:
    if t%2==0:
        res = 0
    else:
        dl = dr = None
        if i1!=INF and i0!=INF:
            dr = abs(i1-i0)
        if j0!=INF and j1!=INF:
            dl = abs(j0-j1)
        if (dl is not None and dl%2==0) and (dr is not None and dr%2==0):
            res = 0
        else:
            res = 1
YES = "Alice"
NO = "Bob"
pans(res^(f^1))
0