結果
問題 | No.1894 Delete AB |
ユーザー |
|
提出日時 | 2022-04-08 21:31:16 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 216 ms / 2,000 ms |
コード長 | 474 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 82,012 KB |
実行使用メモリ | 90,624 KB |
最終ジャッジ日時 | 2024-11-28 12:06:56 |
合計ジャッジ時間 | 2,691 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 14 |
ソースコード
t = int(input()) for _ in range(t): n = int(input()) S = input() l = [] for s in S: if s == "A": l.append(s) continue if len(l) < 2: l.append(s) continue # print(l) while len(l) >= 2: if l[-1] == "B" and l[-2] == "A": l.pop() l.pop() else: break l.append(s) # print("ans") print(*l,sep="")