Public Judge

pjudge

時間限制: 2 s 記憶體限制: 512 MB 總分: 100

#21838. 【PR #13】Rotating Sequence

统计

Given $N, K, L$, construct two binary strings $S$ and $T$ such that:

  • Both $S$ and $T$ have length $N$.
  • $S$ contains exactly $K$ ones.
  • $T$ contains exactly $L$ ones.

Subject to these conditions, you want to minimize:

  • The maximum number of ones in the binary string $R_i$ where $R_i = S_i \operatorname{and} T_i$, after applying any cyclic shift to $S$ and $T$.

Input

The input consists of a single line containing three integers $N, K, L$. It is guaranteed that $0 \leq K, L \leq N$.

Output

The first line of the output contains an integer representing the minimum value for the optimal construction.

The next line describes the constructed string $S$.

The next line describes the constructed string $T$.

If there are multiple valid solutions, you may output any one of them.

Examples

Input 1

6 4 3

Output 1

2
011011
101010

Input 2

5 2 0

Output 2

0
01001
00000

Input 3

10 7 6

Output 3

5
1101100111
1110001101

Subtasks

Subtask Score Additional Constraints
$1$ $5$ $1 \leq N \leq 13$
$2$ $50$ $1 \leq N \leq 5\,000$
$3$ $45$ $1 \leq N \leq 500\,000$

Specifically, if your program outputs the correct result on the first line but the constructed solution is incorrect, you can receive $20\%$ of the points for that test case.

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.