A1: Correction

Time Limit: 3 seconds

Memory Limit: 512 MiB

Score: 100 points

Problem Statement

Given an integer kk where 0k<40 \leq k < 4, implement an oracle E(k)E(k) on a 33-qubit quantum circuit qc\mathrm{qc} which satisfies the following condition:

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}

where 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}

Constraints

  • 0k<40 \leq k < 4
  • 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(k: int) -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
 
    return qc

Hints

Open
  • E(1)=XIIE(1) = X \otimes I \otimes I means applying the XX gate to the 1st qubit.
  • You can apply the quantum gate gg to the ii-th qubit of the quantum circuit qc\mathrm{qc} as follows:
qc.g(i)

Please sign in to submit your answer.