50057. Consecutive 0's and 1's

I'm a slow walker, but I never walk backwards.

Task Description

Given $N$ 32-bit integers, concatenate their 32-bit binary representations and output each group of consecutive 0's or 1's in a single line.

A 32-bit integer has 32 bits, so after we concatenate $N$ of them, we will get a bit string of length $32 * N$. For example, if we have two integers $50$ and $1744830463$, then the binary representation of $50$ is 00000000000000000000000000110010, and that of $1744830463$ is 01100111111111111111111111111111. After we concatetnate them we will have 0000000000000000000000000011001001100111111111111111111111111111.

Your task is to print each group of consecutive 0's or 1's within the bit string, each in a single line, starting from the most significant bit. If a group starts at the $s$-th most significant bit, you should output ($s$ % $40$) spaces before the group, and a newline character ('\n') after the group. Note that each line should not contain any trailing spaces before the newline character. (每行輸出最後一個 0 或 1 之後直接換行,不能有多的空白). For example, the output for the bit string 0000000000000000000000000011001001100111111111111111111111111111 is as follows.

00000000000000000000000000
                          11
                            00
                              1
                               00
                                 11
                                   00
                                     111111111111111111111111111

Input Format

Input contains two lines. The first line contains an integer $N$, representing the number of 32-bit integers. The second line contains $N$ 32-bit non-negative integers.

  • $1 \leq N \leq 10000$

Output Format

Output each group of consecutive 0's or 1's in a single line, with spaces properly appended to the front and without any trailing spaces before the newline character.

Sample Input 1

2
50 1744830463

Sample Output 1

00000000000000000000000000
                          11
                            00
                              1
                               00
                                 11
                                   00
                                     111111111111111111111111111

Sample Input 2

2
1744830463 50

Sample Output 2

0
 11
   00
     111111111111111111111111111
                                00000000000000000000000000
                  11
                    00
                      1
                       0

Discussion