#P1325. The Smallest Open Interval
The Smallest Open Interval
The Smallest Open Interval
题目描述
Given a set of points on the -axis. For any point , you are suppose to find the smallest open interval that contains , provided that the two ends of the interval must be in .
输入格式
Each input file contains one test case. Each case consists of several lines of commands, where each command is given in the format:
cmd num
where is either for "insert", or for "query", or for "end"; and is an integer coordinate of a point on the -axis. It is guaranteed that num is in the range . The input is ended by . It is guaranteed that there are no more than distinct points in , and so is the number of queries. The total number of commands (E not included) is no more than .
输出格式
For each case, insert into . For each case, output the smallest open interval that contains num in the format , where both must be in . On the other hand, if num is no larger than the smallest point in , s1 shall be replaced by , representing negative infinity; or if num is no smaller than the largest point in , shall be replaced by , representing positive infinity. It is guaranteed that there must be at least point in before the first query.
样例 #1
样例输入 #1
I 100
Q 100
I 0
I 33
I -200
Q 25
Q 33
Q -200
Q 200
E
样例输出 #1
(-inf, +inf)
(0, 33)
(0, 100)
(-inf, 0)
(100, +inf)