The meaning of the world must lie outside the world All things in the world are as they are and happen as they happen There is no value in the world —— Tractatus Logico-Philosophicus
Fengmi gives you a string $$$s$$$ of length $$$n$$$, consisting only of '(' and ')'.
You need to support $$$q$$$ operations:
$$$$$$f(l,r) = \max (\left\{ j - i + 1 \mid l \le i \le j \le r \land \text{valid}(i,j) \right\}\cup \{0\})$$$$$$
where $$$\text{valid}(i,j)$$$ indicates that the substring $$$s[i..j]$$$ is a valid parentheses sequence.
In this problem, a valid parentheses sequence is defined as follows:
The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 2 \times 10^5$$$) — the length of the bracket string and the number of operations.
The second line contains a string $$$s$$$ of length $$$n$$$, consisting only of the characters '(' and ')'. The given string is not guaranteed to be a valid parentheses sequence.
The next $$$q$$$ lines each describe one of the following two operations:
For each operation of type $$$2$$$, output a single integer on its own line — the answer.
8 5()(()())2 1 81 42 1 81 72 1 8
8 4 4
12 6(()())(()())2 1 121 32 1 121 82 1 122 4 9
12 10 12 2
Sample 1:
Sample 2:
| Название |
|---|


