結果

問題 No.1894 Delete AB
ユーザー first_vilfirst_vil
提出日時 2022-04-10 09:49:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 979 ms
コンパイル使用メモリ 87,332 KB
実行使用メモリ 89,388 KB
最終ジャッジ日時 2023-08-20 14:09:10
合計ジャッジ時間 4,618 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,652 KB
testcase_01 AC 116 ms
77,236 KB
testcase_02 AC 118 ms
77,184 KB
testcase_03 AC 127 ms
77,952 KB
testcase_04 AC 144 ms
77,968 KB
testcase_05 AC 119 ms
77,528 KB
testcase_06 AC 154 ms
78,272 KB
testcase_07 AC 132 ms
77,920 KB
testcase_08 AC 133 ms
77,796 KB
testcase_09 AC 119 ms
77,548 KB
testcase_10 AC 124 ms
77,644 KB
testcase_11 AC 112 ms
76,836 KB
testcase_12 AC 119 ms
77,388 KB
testcase_13 AC 125 ms
81,692 KB
testcase_14 AC 139 ms
89,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

int1 = lambda x: int(x) - 1

# input = lambda: sys.stdin.buffer.readline()
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
i1 = lambda: int1(input())
mi = lambda: map(int, input().split())
mi1 = lambda: map(int1, input().split())
li = lambda: list(mi())
li1 = lambda: list(mi1())
lli = lambda n: [li() for _ in range(n)]

INF = float("inf")
mod = int(1e9 + 7)
# mod = 998244353

for _ in range(ii()):
    n = ii()
    t = []
    for c in input():
        t.append(c)
        while len(t) >= 3 and t[-3:] == ["A", "B", "B"]:
            t.pop()
            t.pop()
            t.pop()
            t.append("B")
    print("".join(t))
0