結果

問題 No.1894 Delete AB
ユーザー 👑 rin204rin204
提出日時 2022-04-08 21:59:31
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 316 bytes
コンパイル時間 1,979 ms
コンパイル使用メモリ 86,648 KB
実行使用メモリ 83,592 KB
最終ジャッジ日時 2023-08-19 00:35:36
合計ジャッジ時間 4,311 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,488 KB
testcase_01 AC 93 ms
77,128 KB
testcase_02 AC 84 ms
76,444 KB
testcase_03 AC 193 ms
78,040 KB
testcase_04 AC 188 ms
79,572 KB
testcase_05 AC 177 ms
78,084 KB
testcase_06 AC 175 ms
78,104 KB
testcase_07 RE -
testcase_08 AC 188 ms
78,336 KB
testcase_09 AC 129 ms
77,664 KB
testcase_10 AC 134 ms
77,636 KB
testcase_11 AC 97 ms
77,480 KB
testcase_12 AC 92 ms
76,772 KB
testcase_13 AC 85 ms
83,592 KB
testcase_14 AC 78 ms
76,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    S = input()
    T = []
    for s in S[::-1]:
        if s == "B":
            T.append(s)
        elif len(T) >= 2 and T[-1] == "B" and T[-2] == "B":
            T.pop()
        else:
            T.append(s)
    print(*T[::-1], sep="")

for _ in range(int(input())):
    solve()
0