結果

問題 No.1894 Delete AB
ユーザー 👑 rin204rin204
提出日時 2023-05-22 06:59:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 203 ms / 2,000 ms
コード長 293 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 83,332 KB
最終ジャッジ日時 2023-08-23 19:12:47
合計ジャッジ時間 3,556 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,516 KB
testcase_01 AC 93 ms
77,712 KB
testcase_02 AC 87 ms
77,340 KB
testcase_03 AC 188 ms
78,788 KB
testcase_04 AC 203 ms
78,436 KB
testcase_05 AC 168 ms
79,016 KB
testcase_06 AC 203 ms
78,872 KB
testcase_07 AC 158 ms
78,636 KB
testcase_08 AC 168 ms
78,444 KB
testcase_09 AC 122 ms
78,440 KB
testcase_10 AC 120 ms
78,292 KB
testcase_11 AC 99 ms
77,224 KB
testcase_12 AC 97 ms
77,260 KB
testcase_13 AC 88 ms
83,332 KB
testcase_14 AC 82 ms
76,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    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="")


0