結果
| 問題 | No.3503 Brackets Stack Query 2 |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2026-10-18 02:29:46 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 747 bytes |
| 記録 | |
| コンパイル時間 | 82 ms |
| コンパイル使用メモリ | 64,964 KB |
| 実行使用メモリ | 60,760 KB |
| 最終ジャッジ日時 | 2026-10-18 02:30:03 |
| 合計ジャッジ時間 | 12,203 ms |
|
ジャッジサーバーID (参考情報) |
judge6_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 31 |
ソースコード
import sys
# input = sys.stdin.readline
Q = int(input())
st = []
st2 = []
for _ in range(Q):
qs = input().split()
if True:
continue
if qs[0] == '1':
c = qs[1]
if c == ')':
if len(st) >= 2 and st[-2] == '(' and st[-1] == '|':
st.pop()
st.pop()
st2.append(True)
else:
st.append(c)
st2.append(False)
else:
st.append(c)
st2.append(False)
elif qs[0] == '2':
if st2.pop():
st.append('(')
st.append('|')
else:
st.pop()
else:
assert False
if len(st) == 0:
print('Yes')
else:
print('No')
norioc