| Bay Area Programming Contest 2025 |
|---|
| Finished |
For a bitstring $$$s$$$ (meaning $$$s$$$ consists of 0s and 1s), we define $$$f(s)$$$ as the string obtained by replacing each 0 in $$$s$$$ with 001, and each 1 with 01. For example, $$$f(\texttt{001}) = \texttt{00100101}$$$, and $$$f(\texttt{111}) = \texttt{010101}$$$.
We write $$$f^x(s)$$$ to denote applying $$$f$$$ to some string $$$x$$$ times. For example, $$$f^5(s)$$$ means $$$f(f(f(f(f(s)))))$$$.
You are given a list of $$$n$$$ distinct integers $$$a_1, a_2, \ldots, a_n$$$. You need to find bitstrings $$$s$$$ and $$$t$$$ that satisfy all the following conditions:
Note that this last condition implies that all values $$$a_i$$$ must be less than or equal to the length of $$$S$$$ and $$$T$$$.
We guarantee that a solution exists in all tests. If there are multiple solutions, you can output any of them.
The first line contains $$$n$$$, the number of positions ($$$2 \leq n \leq 3 \cdot 10^5$$$).
The next $$$n$$$ lines contain integers $$$a_1, a_2, \ldots, a_n$$$, the positions ($$$1 \leq a_i \leq 10^{18}$$$).
it is guaranteed that all positions are distinct, and that a solution exists.
Output $$$s$$$ and $$$t$$$ satisfying the conditions above, on two separate lines.
If there are multiple solutions, you can output any of them.
211349031701134903171
10 01
41134903170226980634011349031712269806341
110 011
6113490317011349031712269806340226980634141061182434106118244
1100001 0101001
812318354730164244729722971215074104820428262971215073104820428271642447297312318354729
0101111100110 0011111001101
Why the magic number $$$22$$$ in the problem statement? Maybe one of the organizers is a Taylor Swift fan (guess who).
In the first test, $$$s$$$ and $$$t$$$ differ by exactly two positions. $$$f(s) = \texttt{01001}$$$ and $$$f(t)=\texttt{00101}$$$, which also differ by exactly two positions. In fact, we can show that for all positive integers $$$n$$$, $$$f^n(s)$$$ and $$$f^n(t)$$$ differ by exactly two positions.
In the second test, note that solutions such as $$$s=\texttt{011}$$$ and $$$t=\texttt{110}$$$ would also be accepted.
In the third test, note that solutions such as $$$s=\texttt{1100}$$$ and $$$t=\texttt{0101}$$$ would also be accepted.
| Name |
|---|


