Problem Statement
You are given integers and . Implement the oracle on a quantum circuit with qubits, which multiplies all the probability amplitudes of by .
Constraints
- Global phase is ignored in judge.
- Integers must be encoded by little-endian.
- The submitted code must follow the specified format:
from qiskit import QuantumCircuit
def solve(n: int, L: int) -> QuantumCircuit:
qc = QuantumCircuit(n)
# Write your code here:
return qc
Sample Input
- : The implemented oracle should perform the following transformation.
Hints
Open
- You can apply the multi-controlled gate of any quantum gate as follows:
from qiskit.circuit.library import Gate
qc.append(Gate().control(n - 1), range(n))