CF2030B.Minimise Oneness

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Minimise Oneness

For an arbitrary binary string tt^{\text{∗}}, let f(t)f(t) be the number of non-empty subsequences^{\text{†}} of tt that contain only 0, and let g(t)g(t) be the number of non-empty subsequences of tt that contain at least one 1.

Note that for f(t)f(t) and for g(t)g(t), each subsequence is counted as many times as it appears in tt. E.g., f(000)=7,g(100)=4f(\mathtt{000}) = 7, g(\mathtt{100}) = 4.

We define the oneness of the binary string tt to be f(t)g(t)|f(t)-g(t)|, where for an arbitrary integer zz, z|z| represents the absolute value of zz.

You are given a positive integer nn. Find a binary string ss of length nn such that its oneness is as small as possible. If there are multiple strings, you can print any of them.

^{\text{∗}}A binary string is a string that only consists of characters 0 and 1.

^{\text{†}}A sequence aa is a subsequence of a sequence bb if aa can be obtained from bb by the deletion of several (possibly, zero or all) elements. For example, subsequences of 1011101 are 0, 1, 11111, 0111, but not 000 nor 11100.

Input

The first line contains an integer tt (1t1041 \leq t \leq 10^4) — the number of test cases.

The only line of each test case contains an integer nn (1n21051 \leq n \leq 2\cdot10^5) — the length of ss.

It is guaranteed that the sum of nn over all test cases does not exceed 21052\cdot10^5.

Output

For each test case, output ss on a new line. If multiple answers exist, output any.

Note

In the first test case, for the example output, f(t)=1f(t)=1 because there is one subsequence that contains only 0 (0), and g(t)=0g(t)=0 because there are no subsequences that contain at least one 11. The oneness is 10=1|1-0|=1. The output 1 is correct as well because its oneness is 01=1|0-1|=1.

For the example output of the second test case, f(t)=1f(t)=1 because there is one non-empty subsequence that contains only 0, and g(t)=2g(t)=2 because there are two non-empty subsequences that contain at least one 1 (01 and 1). The oneness is thus 12=1|1-2|=1. It can be shown that 11 is the minimum possible value of its oneness over all possible binary strings of size 22.

Samples

3
1
2
3
0
01
010

在线编程 IDE

建议全屏模式获得最佳体验