There is no input in this problem; your program only needs to output a solution.
Formally, the state of a single qubit $$$\vert\psi\rangle$$$ can be written as $$$\alpha\vert0\rangle+\beta\vert1\rangle$$$, where $$$\alpha,\beta$$$ are complex numbers satisfying $$$\vert\alpha\vert^2+\vert\beta\vert^2=1$$$. Here, we regard this purely as an abstract mathematical object and do not discuss its physical meaning.
If we measure $$$\vert\psi\rangle$$$:
Different qubits are not always separable. Consider the general state of a two-qubit system $$$$$$ \vert\psi_1\rangle\vert\psi_2\rangle=\alpha_{00}\vert0\rangle\vert0\rangle+\alpha_{01}\vert0\rangle\vert1\rangle+\alpha_{10}\vert1\rangle\vert0\rangle+\alpha_{11}\vert1\rangle\vert1\rangle $$$$$$ where $$$\vert\alpha_{00}\vert^2+\vert\alpha_{01}\vert^2+\vert\alpha_{10}\vert^2+\vert\alpha_{11}\vert^2=1$$$. If this expression cannot be factorized as $$$(\alpha\vert0\rangle+\beta\vert1\rangle)(\gamma\vert0\rangle+\delta\vert1\rangle)$$$, then we say that $$$\vert\psi_1\rangle$$$ and $$$\vert\psi_2\rangle$$$ are in an entangled state. Once an entangled state is formed, the correlation between the two qubits persists even if they are separated far apart in space.
If we measure $$$\vert\psi_1\rangle$$$ in this system:
Quantum gates are basic tools for manipulating qubits.
In this problem, you may use, and are only allowed to use, the H gate, X gate, Z gate, and CNOT gate.
To apply an H, X, or Z gate, you must choose a target qubit $$$\vert\psi\rangle$$$. Suppose before the operation $$$\vert\psi\rangle=\alpha\vert0\rangle+\beta\vert1\rangle$$$, then:
So he designs the $$$\mathcal{HYW}$$$ language — an extremely simple quantum programming language.
A $$$\mathcal{HYW}$$$ program consists of several statements, one per line. The interpreter executes the statements in order from top to bottom.
Statements are divided into measurement statements and operation statements.
A measurement statement has the form $$$\texttt{measure }x$$$, which means to measure $$$\vert\psi_x\rangle$$$. The measurement result is either $$$0$$$ or $$$1$$$.
An operation statement must be one of the following two types:
| Format | Meaning |
| $$$\texttt{ \lt statement \gt }$$$ | Execute <statement> |
| $$$\texttt{if \lt condition \gt then \lt statement \gt }$$$ | If <condition> is true, execute <statement> |
| Format | Meaning |
| $$$\texttt{H }x$$$ | Apply an H gate to the target qubit $$$\vert\psi_x\rangle$$$ |
| $$$\texttt{X }x$$$ | Apply an X gate to the target qubit $$$\vert\psi_x\rangle$$$ |
| $$$\texttt{Z }x$$$ | Apply a Z gate to the target qubit $$$\vert\psi_x\rangle$$$ |
| $$$\texttt{CNOT }x\texttt{ }y$$$ | Apply a CNOT gate with control qubit $$$\vert\psi_x\rangle$$$ and target qubit $$$\vert\psi_y\rangle$$$ |
For example, suppose initially $$$\vert\psi_1\rangle\vert\psi_2\rangle=\vert0\rangle\vert0\rangle$$$. To make $$$\vert\psi_1\rangle\vert\psi_2\rangle=\dfrac{\vert0\rangle\vert0\rangle+\vert1\rangle\vert1\rangle}{\sqrt2}$$$, a $$$\mathcal{HYW}$$$ program can be:
H 1
CNOT 1 2
After each statement is executed, the state evolves as follows:
measure 1
if m1=1 then X 1
if m1=1 then X 2
After each statement is executed, the state evolves as follows:
Initially, $$$\vert\psi_1\rangle=\alpha\vert0\rangle+\beta\vert1\rangle$$$, $$$\vert\psi_2\rangle=\vert0\rangle$$$, and $$$\vert\psi_3\rangle=\vert0\rangle$$$.
Your goal is to make $$$\vert\psi_1\rangle=\vert0\rangle$$$, $$$\vert\psi_2\rangle=\vert0\rangle$$$, and $$$\vert\psi_3\rangle=\alpha\vert0\rangle+\beta\vert1\rangle$$$.
You need to design a $$$\mathcal{HYW}$$$ program with at most $$$16$$$ statements to achieve this goal.
There is no input in this problem.
Output your solution. Do not output any extra content.
Suppose your $$$\mathcal{HYW}$$$ program is:
H 1
CNOT 1 2
Then you may submit the following C++ code:
#include <bits/stdc++.h>
int main() {
puts("H 1");
puts("CNOT 1 2");
return 0;
}
Of course, if you do so, you will receive a Wrong Answer.
| Name |
|---|


