P5482 [JLOI2011] System of Inequalities
Description
Wangwang and Wangmiao have recently been practicing some inequalities. These inequalities are all one-variable inequalities of the form $ax+b>c$. Of course, solving such inequalities is too easy for Wangwang, so Wangmiao wants to challenge him.
Wangmiao gives a set of one-variable inequalities and a value. Wangwang needs to answer: when $x=k$, how many inequalities in the set are satisfied. Clever Wangwang can give the answer quickly every time. Your task is to quickly verify whether Wangwang's answers are correct.
Input Format
The first line contains a positive integer $n$, indicating that there will be $n$ lines following.
Each of the next lines can be in one of the following $3$ forms:
1. `Add a b c`: Add an inequality $ax+b>c$ to the system.
2. `Del i`: Delete the $i$-th added inequality (the first added one is $1$).
3. `Query k`: A query asking, when $x=k$, how many inequalities in the current system are satisfied.
Note: Initially, the system is empty. $a,b,c,i,k$ are all integers. All operations are guaranteed to be valid: there will be no request to delete an inequality that has not been added, but the same inequality may be deleted repeatedly.
Output Format
For each query `Query k`, output one line with one integer, which is the answer to the query.
Explanation/Hint
#### Explanation of Sample 1
The first inequality added to the system is $x+1>1$, and the second is $-2x+4>3$. Therefore, in the first query, only the second inequality can be satisfied, so output `1`.
Then delete the first inequality. In the next query, still only the second inequality can be satisfied, so output $1$.
After deleting the second inequality, since the system contains no inequalities, none can be satisfied, so output $0$.
Continue by adding the third inequality $8x+9>100$. When $x=k=10$, we have $8\times 10+9=89