結果
問題 | No.2278 Time Bomb Game 2 |
ユーザー | sotanishy |
提出日時 | 2023-04-21 22:32:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 58 ms / 2,000 ms |
コード長 | 1,195 bytes |
コンパイル時間 | 367 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 71,424 KB |
最終ジャッジ日時 | 2024-11-06 17:06:06 |
合計ジャッジ時間 | 5,959 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
51,968 KB |
testcase_01 | AC | 38 ms
52,352 KB |
testcase_02 | AC | 38 ms
52,224 KB |
testcase_03 | AC | 38 ms
51,840 KB |
testcase_04 | AC | 38 ms
52,480 KB |
testcase_05 | AC | 38 ms
52,480 KB |
testcase_06 | AC | 45 ms
60,800 KB |
testcase_07 | AC | 50 ms
66,688 KB |
testcase_08 | AC | 42 ms
57,728 KB |
testcase_09 | AC | 45 ms
62,208 KB |
testcase_10 | AC | 50 ms
68,992 KB |
testcase_11 | AC | 55 ms
71,168 KB |
testcase_12 | AC | 54 ms
70,784 KB |
testcase_13 | AC | 50 ms
68,736 KB |
testcase_14 | AC | 56 ms
71,296 KB |
testcase_15 | AC | 49 ms
69,120 KB |
testcase_16 | AC | 49 ms
69,376 KB |
testcase_17 | AC | 55 ms
71,040 KB |
testcase_18 | AC | 49 ms
68,992 KB |
testcase_19 | AC | 58 ms
71,424 KB |
testcase_20 | AC | 52 ms
69,888 KB |
testcase_21 | AC | 45 ms
62,720 KB |
testcase_22 | AC | 51 ms
69,704 KB |
testcase_23 | AC | 44 ms
62,848 KB |
testcase_24 | AC | 46 ms
63,104 KB |
testcase_25 | AC | 55 ms
69,888 KB |
testcase_26 | AC | 53 ms
70,528 KB |
testcase_27 | AC | 54 ms
69,888 KB |
testcase_28 | AC | 54 ms
69,760 KB |
testcase_29 | AC | 52 ms
69,632 KB |
testcase_30 | AC | 53 ms
70,144 KB |
testcase_31 | AC | 46 ms
62,848 KB |
testcase_32 | AC | 46 ms
63,104 KB |
testcase_33 | AC | 46 ms
62,720 KB |
testcase_34 | AC | 54 ms
70,016 KB |
testcase_35 | AC | 55 ms
70,016 KB |
testcase_36 | AC | 46 ms
62,592 KB |
testcase_37 | AC | 54 ms
70,528 KB |
testcase_38 | AC | 56 ms
70,656 KB |
testcase_39 | AC | 48 ms
68,608 KB |
testcase_40 | AC | 55 ms
71,040 KB |
testcase_41 | AC | 48 ms
68,352 KB |
testcase_42 | AC | 54 ms
70,528 KB |
testcase_43 | AC | 55 ms
71,168 KB |
testcase_44 | AC | 50 ms
68,480 KB |
testcase_45 | AC | 55 ms
70,784 KB |
testcase_46 | AC | 55 ms
70,656 KB |
testcase_47 | AC | 48 ms
68,480 KB |
testcase_48 | AC | 47 ms
68,480 KB |
testcase_49 | AC | 55 ms
71,424 KB |
testcase_50 | AC | 53 ms
69,888 KB |
testcase_51 | AC | 54 ms
69,888 KB |
testcase_52 | AC | 45 ms
62,848 KB |
testcase_53 | AC | 45 ms
62,464 KB |
testcase_54 | AC | 45 ms
62,464 KB |
testcase_55 | AC | 50 ms
62,464 KB |
testcase_56 | AC | 51 ms
69,888 KB |
testcase_57 | AC | 46 ms
62,464 KB |
testcase_58 | AC | 51 ms
69,888 KB |
testcase_59 | AC | 45 ms
62,464 KB |
testcase_60 | AC | 54 ms
70,272 KB |
testcase_61 | AC | 54 ms
69,888 KB |
testcase_62 | AC | 46 ms
62,464 KB |
testcase_63 | AC | 51 ms
69,376 KB |
testcase_64 | AC | 55 ms
70,912 KB |
testcase_65 | AC | 56 ms
71,168 KB |
testcase_66 | AC | 55 ms
71,040 KB |
testcase_67 | AC | 53 ms
68,736 KB |
testcase_68 | AC | 55 ms
71,040 KB |
testcase_69 | AC | 51 ms
68,480 KB |
testcase_70 | AC | 51 ms
67,968 KB |
testcase_71 | AC | 40 ms
52,480 KB |
ソースコード
import sys input = sys.stdin.readline N, K, T = map(int, input().split()) c = list(input().rstrip()) K -= 1 flip = False if c[K] == 'B': flip = True c = ['B' if x == 'A' else 'A' for x in c] def answer(ans): if ans == 0: print("Alice" if not flip else "Bob") else: print("Bob" if not flip else "Alice") dist = [] for i in range(K+1, N): if i-K > T: break if c[i] == 'B': dist.append(i - K) break for i in range(K)[::-1]: if K-i > T: break if c[i] == 'B': dist.append(K - i) break if not dist: answer(1) exit() if max(dist) > 1: if any(T % 2 == d % 2 for d in dist): answer(0) else: answer(1) else: if T % 2 == 0: answer(1) else: if T == 1: answer(0) else: # check right i = K+1 while i < N and c[i] == 'B': i += 1 right = i-(K+1) <= T-1 and (i-(K+1)) % 2 == 0 i = K-1 while i >= 0 and c[i] == 'B': i -= 1 left = (K-1)-i <= T-1 and ((K-1)-i) % 2 == 0 answer(1 if left and right else 0)