A3: Detection

Time Limit: 3 seconds

Memory Limit: 512 MiB

Score: 500 points

Problem Statement

For an integer kk where 0k<40 \leq k < 4, define E(k)E(k) as follows:

E(0)=IIIE(1)=XIIE(2)=IXIE(3)=IIX\begin{aligned} E(0) &= I \otimes I \otimes I \\ E(1) &= X \otimes I \otimes I \\ E(2) &= I \otimes X \otimes I \\ E(3) &= I \otimes I \otimes X \end{aligned}

Here, II is the 2×22 \times 2 identity matrix, and XX is the XX gate.

I=(1001),X=(0110)I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix},\quad X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}

Given ψ=α000+β111\ket{\psi} = \alpha \ket{000} + \beta \ket{111} (where α\alpha and β\beta are arbitrary complex numbers), implement an oracle OO on a 55-qubit quantum circuit qc\mathrm{qc} which satisfies the following condition:

(E(k)II)ψ00O(E(k)II)ψk(E(k) \otimes I \otimes I) \ket{\psi} \ket{00} \xrightarrow{O} (E(k) \otimes I \otimes I) \ket{\psi} \ket{k}

Constraints

  • Integers must be encoded by little-endian.
  • Global phase is ignored in judge.
  • The submitted code must follow the specified format:
from qiskit import QuantumCircuit
 
 
def solve() -> QuantumCircuit:
    qc = QuantumCircuit(5)
    # Write your code here:
 
    return qc

Hints

Open
  • k\ket{k} is expressed in little-endian. Therefore, writing k=k0+2k1k = k_0 + 2k_1 (k0,k1{0,1}k_0, k_1 \in \{0,1\}), we have k=k0k1\ket{k} = \ket{k_0}\ket{k_1}.

Please sign in to submit your answer.