B1: Copy Oracle

Time Limit: 3 sec

Memory Limit: 512 MiB

Score: 100

Problem Statement

Implement the oracle OO on a quantum circuit qc\mathrm{qc} with 22 qubits acting on computational basis states as

xyOxyx,\ket{x}\ket{y} \xrightarrow{O} \ket{x}\ket{y \oplus x},

where \oplus denotes the XOR operator.

Constraints

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

Sample Input

  • xy=12(00+10)\ket{x}\ket{y} = \frac{1}{\sqrt{2}} (\ket{00} + \ket{10})
    The implemented oracle OO should perform the following transformation.
xy=12(00+10)O12(00+11)\ket{x}\ket{y} = \frac{1}{\sqrt{2}} (\ket{00} + \ket{10}) \xrightarrow{O} \frac{1}{\sqrt{2}} (\ket{00} + \ket{11})

Hints

Open
  • You can apply the quantum gate gg to the qubit xx as follows:
qc.g(x)

Please sign in to submit your answer.