QOJ.ac

QOJ

Süre Sınırı: 4.0 s Bellek Sınırı: 256 MB Toplam puan: 100 Hack'lenebilir ✓

#14092. 好多 LCS

İstatistikler

畀定 $K$,構造兩個長度最多係 $8848$ 嘅非空二進制字串 $S$ 同 $T$,令佢哋啱啱有 $K$ 個唔同嘅最長公共子序列。形式上,如果 $L$ 係 $S$ 同 $T$ 嘅最長公共子序列嘅長度,就應該啱啱有 $K$ 個長度係 $L$ 嘅唔同二進制字串,同時係 $S$ 同 $T$ 嘅子序列。

保證喺本題嘅限制之下,一定存在咁樣嘅字串。

輸入格式

輸入唯一一行有一個整數 $K$($1\le K\le 10^9$)。

輸出格式

分開兩行輸出非空二進制字串 $S$ 同 $T$。每個字串嘅長度都唔可以超過 $8848$,佢哋嘅長度可以唔同。

如果有多過一個解,可以輸出任何一個。

例子

輸入格式 1

1

輸出格式 1

1111
00

輸入格式 2

2

輸出格式 2

10
01

輸入格式 3

3

輸出格式 3

010
1001

輸入格式 4

100

輸出格式 4

10001000001011100001010100011
11000010001010101001010011100

說明

喺第一個例子,1111 同 00 嘅最長公共子序列長度係 $0$,只有一個長度係 $0$ 嘅字串同時係佢哋嘅子序列,就係空字串。

喺第二個例子,字串 10 同 01 嘅最長公共子序列長度係 $1$,有 $2$ 個長度係 $1$ 嘅字串同時係 $S$ 同 $T$ 嘅子序列:0 同 1。

喺第二個例子,字串 010 同 1001 嘅最長公共子序列長度係 $2$,有 $3$ 個長度係 $2$ 嘅字串同時係 $S$ 同 $T$ 嘅子序列:00、01 同 10。

整啲比 Everest 仲長嘅字串就唔尊重佢喇……

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.