Jetpack Problem
题号:NC243985
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Jetpack Joyride is a 2011 side-scrolling endless runner action video game. The game uses a simple, one-touch system to control the jetpack; when the player presses anywhere on the touchscreen, the jetpack fires and Barry rises. When the player lets go, the jetpack turns off, and Barry falls. Because he is continually in motion, the player does not control his speed, simply his movement along the vertical axis.(Wikipedia)

Cuber QQ is playing on a modified version of this game. The map can be regarded as an infinite 2d-plane. We assume that the player's position is (i,h_i) at the i-th frame(). For any valid sequence h, since the player starts at (0,0). Also, there must exist a sequence d, such that:



There are n coins on the map, the j-th coin is at (x_j,y_j). By coincidence, x is strictly increasing, and the j-th coin has value . The player can get a coin, if and only if . Cuber QQ wants to know: the largest possible total value of coins he can get by playing only once. Output this number in its binary representation.

输入描述:

The first line contains an integer T(1\le T\le 10\ 000), denoting the number of test cases.

In each test case, the first line contains an integer n(n\ge 1). In the next n lines, the j-th line contains two integers x_j and y_j.

It is guaranteed that 0< x_1<x_2<\cdots < x_n < 10^8, |y_i|\le 5\times 10^{15}, and \sum n\le 500\ 000. Note that you should use efficient input method.

输出描述:

T lines, each line contains an 01-string of length n, denoting the binary representation of the answer. If the answer has less than n bits, you should add zeros in the front.
示例1

输入

复制
3
5
1 -2
3 0
4 2
8 2
9 0
3
2 3
4 3
5 2
9
68 796
75 1062
79 1219
173 1490
286 -9172
420 -22332
498 -30897
831 -106035
956 -122043

输出

复制
01111
100
111111111

说明

We use red crosses to represent coins and black dots to represent the player's flying route. Here is the explanation for the first test case: