Logo
(追記) (追記ここまで)

24856번 - Balanced Illumination 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB17000.000%

문제

Saint Bitsburg government is preparing a technical requirement for New Year city decoration.

The governor thinks that there should be a garland of $n$ lights on the main square. The lights will turn on and off and entertain the residents of Saint Bitsburg.

The chief designer decided that the garland would change its appearance each second. Every light in the garland can be in two states: on and off. Each second exactly one light will change its state from on to off, or from off to on. Also the chief designer wants all combination of lights in the garland to repeat with a period 2ドル^n$ seconds. During the period of 2ドル^n$ seconds all 2ドル^n$ possible lights combinations in the garland have to be presented.

The city's chief engineer, however, noted that frequently turning lights on and off would cause their malfunction. To minimize the chance of the lights malfunction it is required for every light to be turned on and off approximately the same number of times.

So, the final technical requirement for you --- Chief Programmer of the Government Department of Information Technology --- is here.

  • You need to make a plan of 2ドル^n$ combinations of lights $a_0, a_1, \ldots, a_{2^n-1},ドル where $a_k$ is a line of $n$ zeros and ones, $a_k[i]=1$ means, that the light $i$ in the combination $a_k$ is on, $a_k[i]=0$ means, that the light $i$ in the combination $a_k$ is off.
  • All combinations in the plan have to be distinct.
  • This plan will be launched in a cycle, each second the next combination is presented on the garland, in the $t$-th second the combination $a_{t,円\bmod,2円^n}$ is presented.
  • Adjacent combinations have to differ in exactly one light's state. Combination $a_{2^n-1}$ and $a_0$ also have to differ in exactly one light's state.
  • Let us denote by $c_i$ the number of state changes of the light $i$ during a complete cycle, including the final change from $a_{2^n-1}$ to $a_0$. Then for any $i \ne j$ values $c_i$ and $c_j$ have to differ by no more than 2ドル$.

Get to work!

입력

Input contains one integer $n$ (1ドル \le n \le 17$).

출력

Output 2ドル^n$ lines of $n$ characters --- sequence of combinations in the plan. It is guaranteed that a plan satisfying all requirements exists.

제한

예제 입력 1

3

예제 출력 1

000
010
011
111
110
100
101
001

예제 입력 2

4

예제 출력 2

0000
0010
1010
1011
0011
0111
0110
0100
0101
0001
1001
1101
1111
1110
1100
1000

힌트

In the first sample test $c_1=c_2=2,ドル $c_3=4$.

In the second sample test $c_1=c_2=c_3=c_4=4$.

출처

Olympiad > Russian Olympiad in Informatics > Russia Team High School Programming Contest > Russia Team High School Programming Contest 2021 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /