結果

問題 No.1894 Delete AB
ユーザー lloyzlloyz
提出日時 2022-04-08 22:42:35
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 334 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 265,472 KB
最終ジャッジ日時 2024-05-06 08:18:38
合計ジャッジ時間 3,709 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
57,472 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    n = int(input())
    S = input()
    ANS = ''
    res = 0
    for i in range(n):
        s = S[i]
        if s == 'A':
            ANS += s
        else:
            if ANS[:-1] + S[i + 1:] > ANS + S[i:]:
                ANS = ANS[:-1]
            else:
                ANS += s
    print(ANS)
0