A2. Generate equal superposition of four basis states
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given $N$ qubits in the zero state $|0...0 \rangle$. You are also given four distinct bit vectors which describe four different basis states on $N$ qubits $|\psi_i \rangle$.

Your task is to generate a state which is an equal superposition of the given basis states:

$$|S \rangle = \frac{1}{2} \big( |\psi_0 \rangle + |\psi_1 \rangle + |\psi_2 \rangle + |\psi_3 \rangle \big)$$

You have to implement an operation which takes the following inputs:

• an array of $N$ ($2 \le N \le 16$) qubits,
• a two-dimensional array of Boolean values $bits$ representing the basis states $|\psi_i \rangle$. $bits$ will have exactly 4 elements, each of $bits[i]$ describing the basis state $|\psi_i \rangle$. Each of $bits[i]$ will have $N$ elements, $bits[i][j]$ giving the state of qubit $j$ in the basis state $|\psi_i \rangle$. Bit values true and false corresponding to $|1 \rangle$ and $|0 \rangle$ states, respectively; for example, for $N = 2$ an array [false, true] will represent the basis state $|01\rangle$. Each pair of $bits[i]$ and $bits[j]$ will differ in at least one position for $i \neq j$.

The operation doesn't have an output; its "output" is the state in which it leaves the qubits.

Your code should have the following signature:

namespace Solution {    open Microsoft.Quantum.Primitive;    open Microsoft.Quantum.Canon;    operation Solve (qs : Qubit[], bits : Bool[][]) : Unit {        // your code here    }}