結果

問題 No.2278 Time Bomb Game 2
ユーザー shobonvipshobonvip
提出日時 2023-04-21 22:21:05
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,157 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 77,312 KB
最終ジャッジ日時 2024-04-24 09:37:37
合計ジャッジ時間 5,726 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,096 KB
testcase_01 AC 40 ms
51,584 KB
testcase_02 AC 39 ms
52,096 KB
testcase_03 AC 40 ms
52,096 KB
testcase_04 AC 38 ms
52,096 KB
testcase_05 AC 41 ms
51,712 KB
testcase_06 AC 47 ms
61,440 KB
testcase_07 AC 52 ms
67,840 KB
testcase_08 AC 52 ms
68,864 KB
testcase_09 AC 57 ms
75,520 KB
testcase_10 AC 53 ms
67,200 KB
testcase_11 AC 52 ms
69,248 KB
testcase_12 AC 41 ms
53,504 KB
testcase_13 AC 57 ms
75,648 KB
testcase_14 AC 56 ms
71,424 KB
testcase_15 AC 58 ms
73,216 KB
testcase_16 AC 53 ms
67,328 KB
testcase_17 AC 49 ms
62,336 KB
testcase_18 AC 52 ms
67,712 KB
testcase_19 AC 52 ms
69,248 KB
testcase_20 AC 47 ms
62,080 KB
testcase_21 AC 47 ms
59,520 KB
testcase_22 AC 43 ms
59,008 KB
testcase_23 AC 56 ms
73,600 KB
testcase_24 AC 59 ms
75,904 KB
testcase_25 AC 56 ms
71,936 KB
testcase_26 AC 53 ms
70,912 KB
testcase_27 AC 56 ms
74,240 KB
testcase_28 AC 51 ms
65,536 KB
testcase_29 AC 54 ms
71,040 KB
testcase_30 AC 52 ms
69,248 KB
testcase_31 AC 49 ms
61,056 KB
testcase_32 AC 50 ms
67,456 KB
testcase_33 AC 53 ms
69,504 KB
testcase_34 AC 56 ms
74,368 KB
testcase_35 AC 57 ms
76,544 KB
testcase_36 AC 50 ms
66,816 KB
testcase_37 AC 52 ms
68,096 KB
testcase_38 AC 51 ms
68,700 KB
testcase_39 AC 58 ms
75,904 KB
testcase_40 AC 47 ms
60,672 KB
testcase_41 AC 56 ms
71,680 KB
testcase_42 AC 40 ms
53,376 KB
testcase_43 AC 55 ms
69,248 KB
testcase_44 AC 48 ms
60,800 KB
testcase_45 AC 51 ms
64,000 KB
testcase_46 AC 48 ms
61,824 KB
testcase_47 AC 53 ms
69,376 KB
testcase_48 AC 57 ms
77,312 KB
testcase_49 AC 52 ms
71,552 KB
testcase_50 AC 49 ms
62,336 KB
testcase_51 AC 53 ms
72,192 KB
testcase_52 AC 46 ms
59,904 KB
testcase_53 AC 55 ms
70,784 KB
testcase_54 AC 47 ms
61,952 KB
testcase_55 AC 49 ms
63,104 KB
testcase_56 AC 44 ms
59,008 KB
testcase_57 AC 52 ms
66,560 KB
testcase_58 AC 46 ms
60,800 KB
testcase_59 AC 58 ms
73,216 KB
testcase_60 AC 56 ms
74,112 KB
testcase_61 AC 48 ms
61,056 KB
testcase_62 AC 56 ms
75,776 KB
testcase_63 AC 45 ms
59,392 KB
testcase_64 AC 44 ms
59,392 KB
testcase_65 AC 46 ms
59,392 KB
testcase_66 AC 45 ms
58,880 KB
testcase_67 AC 43 ms
59,008 KB
testcase_68 AC 46 ms
59,136 KB
testcase_69 AC 45 ms
59,136 KB
testcase_70 AC 45 ms
59,136 KB
testcase_71 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k,t = map(int,input().split())
c = input()

# 片方しかない
if 'A' not in c:
	print("Alice")
	exit()

if 'B' not in c:
	print("Bob")
	exit()

# 長さ偶数に到達させてはならない

rl = []
moji = ""
cnt = 0
for i in range(n):
	if moji != c[i]:
		if cnt > 0:
			rl.append((moji,cnt))
		cnt = 1
		moji = c[i]
	else:
		cnt += 1
if cnt > 0:
	rl.append((moji, cnt))

m = len(rl)
v = 0
ind = -1
indi = -1
for i in range(m):
	v += rl[i][1]
	if v >= k:
		v -= rl[i][1]
		indi = i
		ind = k-v-1
		break

mindist = 10 ** 9
if indi >= 1:
	mindist = min(mindist, ind + 1)
if indi < m-1:
	mindist = min(mindist, rl[indi][1] - ind)

# 到達不能!
if mindist > t:
	if rl[indi][0] == "A":
		print("Bob")
	else:
		print("Alice")
	exit()

if indi >= 1:
	# 左側でしめれる
	if ind + 1 <= t and (t-(ind+1)) % 2 == 0:
		if rl[indi][0] == "A":
			print("Alice")
		else:
			print("Bob")
		exit()
if indi < m-1:
	# 右側でしめれる
	if rl[indi][1] - ind <= t and (t-(rl[indi][1] - ind)) % 2 == 0:
		if rl[indi][0] == "A":
			print("Alice")
		else:
			print("Bob")
		exit()

# 無理
if rl[indi][0] == "A":
	print("Bob")
else:
	print("Alice")

exit()
0