Exact Subsequences

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Consider all binary strings that have exactly nn different non-empty subsequences (different by contents). Sort the strings in lexicographic order. Find the kk-th such string in this order.

입력

Each test contains multiple test cases. The first line contains an integer tt (1t1001\le t \le 100) --- the number of test cases. The descriptions of the tt test cases follow.

The description of each test case consists of a single line with two integers nn and kk (1n,k1091 \le n, k \le 10^9).

출력

For each test case, if there are less than kk binary strings with exactly nn different non-empty subsequences, print -1 on a single line. Otherwise, print lexicographically kk-th of them on the next two lines in the following format:

A non-empty binary string can be uniquely described by its first character and list of sizes of blocks of equal characters. You should print mm and cc on the first line, where mm is the number of blocks and cc is the first character. Then, on the second line, print the sizes of blocks L_1,L_2,,L_mL\_1, L\_2, \ldots, L\_m in order.

힌트

The actual strings corresponding to answers to the sample are:

000
01
10
111
-1
000...000 (1000000000 times)
0000000001100100000011011000000010
00000000011111111100000000110000111100011111000