結果
| 問題 | No.3503 Brackets Stack Query 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 13:02:00 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 372 bytes |
| 記録 | |
| コンパイル時間 | 601 ms |
| コンパイル使用メモリ | 20,820 KB |
| 実行使用メモリ | 27,736 KB |
| 最終ジャッジ日時 | 2026-04-18 13:03:14 |
| 合計ジャッジ時間 | 33,738 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | TLE * 12 -- * 18 |
ソースコード
q=int(input())
c=[0]*q
def check(s,tt):
b=0
for i in range(tt):
if s[i]==0:
b+=1
c[b]=0
elif s[i]==2:
if c[b]==0:
return False
b-=1
else:
if c[b]==1:
return False
c[b]=1
return b==0
ss=[0]*q
y=0
for _ in range(q):
t=input()
if t[0]=="1":
ss[y]="(|)".index(t[2])
y+=1
else:
y-=1
print("Yes" if check(ss,y) else "No",flush=True)