Problem Statement
You are given integers n, L, and a real number θ.
Implement the oracle O on a quantum circuit qc with n qubits acting on computational basis states as
∣y⟩nO{eiθ∣y⟩neiθ∣y⟩ny=Ly=L
for any integer y such that 0≤y<2n.
Constraints
- 1≤n≤10
- 0≤L<2n
- 0≤θ<2π
- 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(n: int, L: int, theta: float) -> QuantumCircuit:
qc = QuantumCircuit(n)
# Write your code here:
return qc
Sample Input
- n=2, L=1, θ=π/2:
Implemented circuit qc should perform the following transformation.
41(∣00⟩+∣10⟩+∣01⟩+∣11⟩)qc41(∣00⟩+i∣10⟩+∣01⟩+∣11⟩)