|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|5 초||1024 MB||8||5||3||100.000%|
For two arrays of integers $A$ of size $N$ and $B$ of size $M$, we define a grid $G(A, B)$ of size $N \times M$, where cell $(i,\, j)$ is colored black if $0 \le A_i + B_j$ and white otherwise.
We also define $F(A, B)$ as the number of black rectangles inside $G(A, B)$, where each cell of $G(A, B)$ is either entirely included in or disjoint with the rectangle.
In other words, $F(A, B)$ is equal to the number of tuples $(l_1,\, r_1,\, l_2,\, r_2)$ such that $1 \le l_1 \le r_1 \le N$, $1 \le l_2 \le r_2 \le M$ and each cell $(i,\, j)$ in $G(A, B)$ is colored black for all $i$, $j$ such that $l_1 \le i \le r_1$, $l_2 \le j \le r_2$.
Initially, only $A_1$ and $B_1$ are given.
Then, you should process following $Q$ queries:
The first line contains one integer $Q$.
The second line contains two space-separated integers, $A_1$ and $B_1$.
Each of the following $Q$ lines contains two space-separated integers denoting the queries in the described form.
For each query of types 1 and 3, output a single integer denoting the answer to that query. Each answer should go on its own line.
Let $N$ be the size of array $A$ after processing all queries, and $M$ be the size of array $B$ after processing all queries.
This subtask has additional constraints:
This subtask has an additional constraint:
This subtask has no additional constraints.
4 -4 -3 0 -5 2 2 0 3 3 -5
8 -187121777 648583176 0 536185451 1 77324177 2 -543947071 1 -495948203 2 809620127 2 918209957 3 -724806401 1 30094601
6 10 40 60