A2: Encoding

Time Limit: 3 seconds

Memory Limit: 512 MiB

Score: 200 points

Problem Statement

Implement an oracle OO on a 33-qubit quantum circuit qc\mathrm{qc} which satisfies the following condition:

000O000100O111\begin{aligned} \ket{000} &\xrightarrow{O} \ket{000} \\ \ket{100} &\xrightarrow{O} \ket{111} \end{aligned}

The output of OO for inputs other than 000\ket{000} and 100\ket{100} is not specified.

Constraints

  • 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() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
 
    return qc

Hints

Open
  • You can apply a multi-controlled gate of a quantum gate Gate\mathrm{Gate} as follows:
from qiskit.circuit.library import Gate
 
qc.append(Gate().control(n - 1), range(n))

Please sign in to submit your answer.