結果
| 問題 | No.3503 Brackets Stack Query 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 12:59:53 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 373 bytes |
| 記録 | |
| コンパイル時間 | 188 ms |
| コンパイル使用メモリ | 85,888 KB |
| 実行使用メモリ | 95,788 KB |
| 最終ジャッジ日時 | 2026-04-18 13:01:04 |
| 合計ジャッジ時間 | 19,521 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | AC * 1 WA * 10 TLE * 1 -- * 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]&1==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)