結果
問題 | No.1894 Delete AB |
ユーザー |
![]() |
提出日時 | 2022-04-08 21:29:57 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 94 ms / 2,000 ms |
コード長 | 321 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 11,984 KB |
最終ジャッジ日時 | 2024-11-28 12:04:45 |
合計ジャッジ時間 | 2,044 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 14 |
ソースコード
import sys input = sys.stdin.readline T=int(input()) for tests in range(T): N=int(input()) S=input().strip() T=[] for s in S[::-1]: if s=="A" and len(T)>=2 and T[-1]=="B" and T[-2]=="B": T.pop() continue else: T.append(s) print("".join(T[::-1]))