cswork / OA打开练习工作台

MetaOA #12

Build Blocks and Obstacles on a Number Line

估计中等可在线判题

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

Perform the operations in order: 1 x places an obstacle at the empty coordinate x; 2 x size checks whether the half-open range [x,x+size) contains no obstacle, outputting the character 1 if so and 0 otherwise. A check operation places nothing. Concatenate all check results into one string.

输入格式

This site's standard input scale: the first line contains q (1..100000); the next q lines are operations 1 x or 2 x size, with x in −10⁹..10⁹ and size in 1..10⁹. When an obstacle is placed, its coordinate is guaranteed to be empty, and there is at least one check.

输出格式

Output the answer as described; separate multiple results with spaces in order, and output an empty line for an empty array.

样例 1

输入:

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

输出:

1010

样例 2

输入:

3
2 0 1
1 0
2 0 1

输出:

10

样例 3

输入:

3
1 -2
2 -3 1
2 -3 2

输出:

10

样例说明

Example 1: the obstacles are at 2 and 5; the four queries [3,5), [3,6), [1,2), [1,3) are clear, blocked, clear, blocked in order, giving 1010.