A5: Generate state 13(0+1+2))\frac{1}{\sqrt{3}} (\ket{0} + \ket{1} + \ket{2})) II

Time Limit: 3 sec

Memory Limit: 512 MiB

Score: 100

Problem Statement

Implement the operation of preparing the state ψ\ket{\psi} from the zero state on a quantum circuit qc\mathrm{qc} with 22 qubits.
The state ψ\ket{\psi} is defined as

ψ=13(0+1+2)=13(00+10+01).\begin{equation} \ket{\psi} = \frac{1}{\sqrt{3}} (\ket{0} + \ket{1} + \ket{2}) = \frac{1}{\sqrt{3}} (\ket{00} + \ket{10} + \ket{01}). \nonumber \end{equation}

Constraints

  • Changes in the global phase are ignored.
  • The submitted code must follow the specified format:
from qiskit import QuantumCircuit
 
 
def solve() -> QuantumCircuit:
    qc = QuantumCircuit(2)
    # Write your code here:
 
    return qc

Hints

Open
  • You can import the math library if necessary.
    Please refer to the Q&A for available libraries.
import math

Please sign in to submit your answer.