結果

問題 No.3503 Brackets Stack Query 2
コンテスト
ユーザー lif4635
提出日時 2026-04-18 18:04:31
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 620 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 276 ms
コンパイル使用メモリ 85,632 KB
実行使用メモリ 119,552 KB
最終ジャッジ日時 2026-04-18 18:04:50
合計ジャッジ時間 15,213 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

"""
ばかでごめんなさい
"""

from math import isqrt
import sys

mod = 998244353
input = sys.stdin.readline
II = lambda : int(input())
MI = lambda : (int(_) for _ in input().split())
LI = lambda : list(int(_) for _ in input().split())

q = II()
st = [""] * (q + 1)
h = [0] * (q + 1)
sl = 0
top = 0
for i in range(q):
    qry = list(input().split())
    if qry[0] == "1":
        c = qry[1]
        st[top] = c
        top += 1
        if st[top-3:top] == ["(", "|", ")"]:
            top -= 3
        sl += 1
        h[sl] = top
    else:
        sl -= 1
        top = h[sl]
    print("Yes" if top == 0 else "No")
0