結果

問題 No.3503 Brackets Stack Query 2
コンテスト
ユーザー norioc
提出日時 2026-10-18 01:27:15
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 570 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 87 ms
コンパイル使用メモリ 64,668 KB
実行使用メモリ 60,760 KB
最終ジャッジ日時 2026-10-18 01:27:38
合計ジャッジ時間 12,877 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

Q = int(input())

st = []
for _ in range(Q):
    qs = input().split()
    if True:
        continue

    match qs:
        case ('1', c):
            if c == ')':
                if len(st) >= 2 and st[-2][0] == '(' and st[-1][0] == '|':
                    st.append((c, True))
                else:
                    st.append((c, False))
            else:
                st.append((c, False))

        case ('2',):
            st.pop()

        case _:
            assert False

    if len(st) == 0 or st[-1][1]:
        print('Yes')
    else:
        print('No')
0