A4: Cyclic Shift Oracle III

Time Limit: 3 seconds

Memory Limit: 512 MiB

Score: 400 points

Problem Statement

Given an integer nn, implement an n+1n+1-qubit oracle OO on a quantum circuit qc\mathrm{qc}.

For any pair of integers (m,k)(m,k) satisfying 0≤k<2n0 \leq k < 2^n and 0≤m<20 \leq m < 2, the oracle must perform the following transformation:

∣k⟩n∣m⟩→O∣m⟩∣k⟩n\ket{k}_n \ket{m} \xrightarrow{O} \ket{m} \ket{k}_n

Constraints

from qiskit import QuantumCircuit
 
 
def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n + 1)
    # Write your code here:
 
    return qc

Hints

Open

Please sign in to submit your answer.