| Abakoda Long 2024 Contest |
|---|
| Закончено |
The RXA cryptosystem is the same in both problems. Skip to paragraph beginning with "Cindy" for the difference between the two problems.
Alice and Bob were attending a cryptography seminar in the province of Siquijor, where they learned about the famous RSA cryptosystem used for public-key encryption. Inspired by this, they decided to create their own cryptosystem which they called RXA.
Suppose Alice wants to send Bob a secret message $$$M$$$, which is a string. They have developed the following three-pass protocol.
First, Alice encodes the string $$$M$$$ into a (possibly very large) integer $$$m$$$ (by a process described below). Now, she communicates this integer $$$m$$$ to Bob by the following procedure.
Let $$$a \oplus b$$$ denote the bitwise XOR of two non-negative integers $$$a$$$ and $$$b$$$ (see Notes for an explanation).
Note that the only values that can be heard by the public are $$$x$$$, $$$y$$$, and $$$z$$$. The secret integers $$$a$$$ and $$$b$$$ are not revealed by Alice and Bob, not even to each other.
Cindy calls them both idiots, because this cryptographic scheme has a fatal flaw. The message $$$M$$$ can actually be retrieved by a malicious third party! Let's prove it. Given $$$n$$$ (the length of the message), and $$$x$$$, $$$y$$$, and $$$z$$$ (the values broadcasted to the public), see if you can recover the secret message $$$M$$$ that Alice wanted to secretly share to Bob.
The encopding process from $$$M$$$ to $$$m$$$ is as follows. Replace each character of $$$M$$$ with a $$$5$$$-bit string as follows:
The first line of input contains a single integer $$$T$$$, denoting the number of test cases. The descriptions of $$$T$$$ test cases follow.
Each test case consists of a single line containing the four space-separated integers $$$|M|$$$, $$$x$$$, $$$y$$$, and $$$z$$$.
For each test case, output one line containing a single string, denoting the answer for that test case.
$$$$$$\begin{align*}
&\begin{array}{|l|} \hline \text{Constraints For All Subtasks} \\ \hline 1 \leq T \leq 10^4 \\ 1 \leq |M| \leq 25 \\ 0 \leq x, y, z \lt 32^{|M|} \\ \hline \end{array}\\
&\begin{array}{|c|c|l|} \hline \text{Subtask} & \text{Points} & \text{Constraints} \\ \hline 1 & \mathbf{75} & |M| \le 6 \\ \hline 2 & \mathbf{20} & |M| \leq 12 \\ \hline 3 & \mathbf{5} & \text{No further constraints.} \\ \hline \end{array}\\
\end{align*}$$$$$$
Note that $$$x$$$, $$$y$$$, and $$$z$$$ can be quite large... beware integer overflow.
2 11 1669541533645137 9059692270620735 1841376433034227 8 940952787971 700576436 700511868052
i_love_you! password
2 18 201191772701226744980892017 470232750687508483322404997 1012763572942237404468826031 21 23476430646951893696212210100392 23476510470843452443909826453115 23476551580580358895321272467822
the_world_wonders. squawk_chirp_quack!!!
The logical XOR accepts two values as input, each $$$0$$$ or $$$1$$$. It returns $$$1$$$ if the two inputs are different, and returns $$$0$$$ if the two inputs are the same.
The bitwise XOR between two non-negative integers is computed by writing both inputs in binary (using the same number of bits, adding padding leading zeros if necessary), and then performing a logical XOR on each corresponding pair of bits at the same place values. For example, $$$5 \oplus 9 = 12$$$. We write $$$5 = 0101_2$$$ and $$$9 = 1001_2$$$, then:
and $$$1100_2 = 12$$$.
0101
1001
====
1100
| Название |
|---|


