Problem Statement
You are given an integer , a real number , an -qubit quantum gate and an -qubit parametric quantum gate of unknown structures.
There exists a vector satisfying the following two conditions:
Using the quantum gates and , implement an operation that prepares the quantum state on a quantum circuit with qubits.
The operation must satisfy within an error of .
Constraints
- The number of applied must not exceed . (If exceeded, a DLE (depth limit exceeded) error will be displayed)
- Global phase is ignored in judge.
- The submitted code must follow the specified format:
from qiskit import QuantumCircuit
"""
You can apply U and R as follows:
qc.compose(U(), inplace=True)
qc.compose(R(theta), inplace=True)
"""
def solve(n: int, P: float, U, R) -> QuantumCircuit:
qc = QuantumCircuit(n)
# Write your code here:
return qc
Hints
Open
- You can use the inverse gates of the quantum gates and .
qc.compose(U().inverse(), inplace=True)
qc.compose(R(theta).inverse(), inplace=True)