結果
| 問題 | No.3503 Brackets Stack Query 2 |
| コンテスト | |
| ユーザー |
2251799813685248
|
| 提出日時 | 2026-11-26 14:24:56 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 765 bytes |
| 記録 | |
| コンパイル時間 | 129 ms |
| コンパイル使用メモリ | 64,128 KB |
| 実行使用メモリ | 491,180 KB |
| 最終ジャッジ日時 | 2026-11-26 14:25:09 |
| 合計ジャッジ時間 | 11,864 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | WA * 10 TLE * 1 -- * 20 |
ソースコード
import sys
sys.setrecursionlimit(10**7)
stk = []
Q = 0
def f():
global Q
if not Q:
return False
Q -= 1
q = input().split()
erased = False
if q[0] == "1":
c = q[1]
stk.append(c)
if len(stk) >= 3 and c == ")":
if stk[-1] == ")" and stk[-2] == "|" and stk[-3] == "(":
erased = True
stk.pop()
stk.pop()
stk.pop()
print("No" if len(stk) else "Yes")
t = f()
if erased:
stk.append("(")
stk.append("|")
stk.append(")")
stk.pop()
if t:
print("No" if len(stk) else "Yes")
f()
else:
return True
return False
Q = int(input())
f()
2251799813685248