結果

問題 No.1894 Delete AB
ユーザー msm1993msm1993
提出日時 2022-07-12 15:35:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 10,608 KB
実行使用メモリ 9,452 KB
最終ジャッジ日時 2023-09-05 17:44:42
合計ジャッジ時間 3,199 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,964 KB
testcase_01 AC 114 ms
8,580 KB
testcase_02 AC 115 ms
8,544 KB
testcase_03 AC 136 ms
7,912 KB
testcase_04 AC 142 ms
7,776 KB
testcase_05 AC 151 ms
7,860 KB
testcase_06 AC 153 ms
7,860 KB
testcase_07 AC 152 ms
7,852 KB
testcase_08 AC 166 ms
7,952 KB
testcase_09 AC 74 ms
7,924 KB
testcase_10 AC 93 ms
7,896 KB
testcase_11 AC 88 ms
7,868 KB
testcase_12 AC 92 ms
8,208 KB
testcase_13 AC 113 ms
9,452 KB
testcase_14 AC 83 ms
8,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    n = int(input())
    s = input()
    ans = []
    for v in s[::-1]:
        ans.append(v)
        if len(ans) >= 3 and ans[-3:] == ["B", "B", "A"]:
            ans.pop(); ans.pop()
    print("".join(ans[::-1]))
0