#P5482. [JLOI2011] 不等式组
[JLOI2011] 不等式组
Description
Wangwang and Wangmiao have recently been practicing some inequalities. These inequalities are all one-variable inequalities of the form . 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 , 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 , indicating that there will be lines following.
Each of the next lines can be in one of the following forms:
Add a b c: Add an inequality to the system.Del i: Delete the -th added inequality (the first added one is ).Query k: A query asking, when , how many inequalities in the current system are satisfied.
Note: Initially, the system is empty. 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.
9
Add 1 1 1
Add -2 4 3
Query 0
Del 1
Query 0
Del 2
Query 0
Add 8 9 100
Query 10
1
1
0
0
Hint
Explanation of Sample 1
The first inequality added to the system is , and the second is . 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 .
After deleting the second inequality, since the system contains no inequalities, none can be satisfied, so output .
Continue by adding the third inequality . When , we have , so no inequality can be satisfied, and the output is still .
Constraints
- For of the data, .
- For of the data, .
- For of the data, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号