cswork / OA打开练习工作台

UberOA #2

Obstacles and Blocks on a Number Line

估计中等可在线判题

考点(AI 标注)二分查找迭代器设计

Operation 1 x places an obstacle at coordinate x; placing it again has no additional effect. Operation 2 x size checks whether the half-open range [x−size,x) contains no obstacle; if it is empty, record 1, otherwise record 0. Queries only check and never place obstacles; finally, concatenate all query results.

This site's standard input/output is stated explicitly.

输入格式

The first line contains q, followed by q lines of operations. 1≤q≤100000. This site's convention is −10⁹≤x≤10⁹ and 1≤size≤10⁹.

输出格式

Output the 01 string formed by the query results; if there are no queries, output an empty line.

样例 1

输入:

6
1 2
1 5
2 5 2
2 6 3
2 2 1
2 3 2

输出:

1010

样例 2

输入:

3
1 0
2 0 1
2 1 1

输出:

10

样例 3

输入:

1
2 -5 3

输出:

1

样例说明

Example 1: the queries [3,5), [3,6), [1,2), and [1,3) contain no, some, no, and some obstacles respectively, so the output is 1010. Example 2: the right end 0 does not belong to [−1,0) but does belong to [0,1), so the output is 10. Example 3: no obstacle is placed, so the output is 1.