結果
| 問題 | No.3503 Brackets Stack Query 2 |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2026-10-18 01:28:44 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 646 bytes |
| 記録 | |
| コンパイル時間 | 80 ms |
| コンパイル使用メモリ | 64,940 KB |
| 実行使用メモリ | 122,920 KB |
| 最終ジャッジ日時 | 2026-10-18 01:30:04 |
| 合計ジャッジ時間 | 76,700 ms |
|
ジャッジサーバーID (参考情報) |
judge6_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 1 TLE * 30 |
ソースコード
Q = int(input())
st = []
st2 = []
for _ in range(Q):
qs = input().split()
match qs:
case ('1', c):
if c == ')':
if len(st) >= 2 and st[-2] == '(' and st[-1] == '|':
st.append(c)
st2.append(True)
else:
st.append(c)
st2.append(False)
else:
st.append(c)
st2.append(False)
case ('2',):
st.pop()
st2.pop()
case _:
assert False
if len(st) == 0 or st2[-1]:
print('Yes')
else:
print('No')
norioc