結果
| 問題 | No.3503 Brackets Stack Query 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 12:37:21 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 338 bytes |
| 記録 | |
| コンパイル時間 | 355 ms |
| コンパイル使用メモリ | 84,992 KB |
| 実行使用メモリ | 81,280 KB |
| 最終ジャッジ日時 | 2026-04-18 12:38:16 |
| 合計ジャッジ時間 | 50,883 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 30 |
ソースコード
q=int(input())
def check(s):
q=0
for i in range(len(s)):
if s[i]=="(":
q<<=1
if s[i]==")":
if q&1==0:
return False
q>>=1
if s[i]=="|":
if q&1==1:
return False
q|=1
return q==0
ss=""
for _ in range(q):
t=input().split()
if t=="1":
ss+=t[1]
elif t=="2":
ss=ss[:-1]
print("Yes" if check(ss) else "No")