結果
| 問題 | No.3503 Brackets Stack Query 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 01:09:36 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 828 bytes |
| 記録 | |
| コンパイル時間 | 574 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 63,064 KB |
| 最終ジャッジ日時 | 2026-04-18 01:10:08 |
| 合計ジャッジ時間 | 23,714 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 WA * 20 |
ソースコード
import sys
readline = sys.stdin.readline
#input_data = sys.stdin.read().split('\n')
#print(input_data)
Q = readline().split()#int(input_data[0])
#print(Q)
st = [''] * 800005
history_sz = [0] * 800005
sz = 0
L = 0
out = []
#idx = 1
for q in range(int(Q[0])):
q_type = readline().split()#input_data[idx].split()
if q_type[0] == "1":
L += 1
st[sz] = q_type[1]
sz += 1
if sz >= 3 and st[sz-3] == '(' and st[sz-2] == '|' and st[sz-1] == ')':
sz -= 3
history_sz[L] = sz
if sz == 0:
out.append("Yes")
else:
out.append("No")
else:
L -= 1
sz = history_sz[L]
if sz == 0:
out.append("Yes")
else:
out.append("No")
#idx += 1
sys.stdout.write('\n'.join(out) + '\n')