You are given n ($1$ $\le$ $n$ $\le$ $300000$) queries. Each query is one of $3$ types:
1. add pair ($a$, $b$) to the set. ($-10^9$ $\le$ $a, b$ $\le$ $10^9$)
2. remove a pair added in query $index$ (All queries are numbered with integers from $1$ to $n$).
3. For a given integer $A$ find the maximal value $a·A + b$ over all pairs ($a$, $b$) from the set. ($-10^9$ $\le$ $A$ $\le$ $10^9$). It is guaranteed that the set of pair will not be *empty*.
INPUT.
The first line contains integer $n$ ($1$ $\le$ $n$ $\le$ $3·10^5$) - the number of queries.
Each of next $n$ lines starts with integer $op$ ($1$ $\le$ $op$ $\le$ $3$) - the type of query.
OUTPUT
For each query of $3$ type print on a separate line the maximal value of $a·A + b$. It is guaranteed that the set of pair will not be *empty*.
1. query of 1 type add pair -1000000000 0 in set.
2. query of 3 type with A = 1000000000 in set we have only pair from 1 query so answer is -1000000000000000000
3. query of 1 type add pair -1000000000 1 in set.
4. query of 3 type with A = 1000000000 in set not we have pair from 1 and 3 queries and maximum value is -999999999999999999 which is reachable by pair from 3 query.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor