結果
| 問題 | No.2278 Time Bomb Game 2 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-04-21 22:13:37 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 1,942 bytes | 
| コンパイル時間 | 238 ms | 
| コンパイル使用メモリ | 82,068 KB | 
| 実行使用メモリ | 89,916 KB | 
| 最終ジャッジ日時 | 2024-11-06 17:05:09 | 
| 合計ジャッジ時間 | 7,017 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 69 WA * 1 | 
ソースコード
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))
            
            
            
        