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

31158번 - Many LCS 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 1024 MB222100.000%

문제

Given $K,ドル construct two non-empty binary strings $S$ and $T$ of length at most 8848 such that they have exactly $K$ different longest common subsequences. More formally, if $L$ is the length of the longest common subsequence of $S$ and $T,ドル there should exist exactly $K$ distinct binary strings of length $L$ which are subsequences of both $S$ and $T$.

It is guaranteed that under the constraints of this problem such strings always exist.

입력

The only line of input contains a single integer $K$ (1ドル \le K \le 10^9$).

출력

Print non-empty binary strings $S$ and $T$ on separate lines. The length of each of them should not exceed 8848ドル$. They can have different lengths.

If there is more than one solution, you can print any one of them.

제한

예제 입력 1

1

예제 출력 1

1111
00

예제 입력 2

2

예제 출력 2

10
01

예제 입력 3

3

예제 출력 3

010
1001

예제 입력 4

100

예제 출력 4

10001000001011100001010100011
11000010001010101001010011100

노트

In the first example, the longest common subsequence of 1111 and 00 has length 0ドル,ドル and there exists only one string of length 0ドル$ which is a subsequence of both of them --- the empty string.

In the second example, the length of the longest common subsequence of strings 10 and 01 is 1ドル,ドル and there are 2ドル$ strings of length 1ドル$ which are subsequences of both $S$ and $T$: 0 and 1.

In the second example, the length of the longest common subsequence of strings 010 and 1001 is 2ドル,ドル and there are 3ドル$ strings of length 2ドル$ which are subsequences of both $S$ and $T$: 00, 01, and 10.

It would be disrespectful to make strings longer than Everest\ldots

출처

Contest > Open Cup > 2021/2022 Season > Stage 7: Grand Prix of Southeastern Europe M번

ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2021 D번

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

출처

대학교 대회

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

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