A7: Zeta / Moebius Transform II

Time Limit: 3 sec

Memory Limit: 512 MiB

Score: 300

Problem Statement

You are given an integer nn.

Let us define [n]={1,2,,n}[n] = \{1, 2, \cdots, n\}, and for a subset SS of [n][n], define a quantum state S\ket{S} by

S=sS2s1.\begin{equation} \ket{S} = \ket{\textstyle \sum_{s \in S} 2^{s - 1}} \nonumber. \end{equation}

Let S|S| denotes the number of elements in a set SS. Implement the following operation on a quantum circuit qc\mathrm{qc} with 2n2n qubits.

S[n]aSSn0nqc13nST[n]aTSn0n+13nTS[n](1)(ST)aTSn2n1n+i=12n2S[n]bS,iSnin\begin{align} \sum_{S \subseteq [n]} a_S \ket{S}_n \ket{0}_n \xrightarrow{\mathrm{qc}} &\sqrt{\frac{1}{3^n}} \sum_{S \subseteq T \subseteq [n]} a_T \ket{S}_n \ket{0}_n \nonumber\\ &+ \sqrt{\frac{1}{3^n}} \sum_{T \subseteq S \subseteq [n]} (-1)^{(|S| - |T|)} a_T \ket{S}_n \ket{2^n - 1}_n\nonumber\\ &+ \sum_{i = 1}^{2^n - 2} \sum_{S \subseteq [n]} b_{S, i} \ket{S}_n \ket{i}_n\nonumber\\ \end{align}

Here, aSa_S represents the probability amplitude of a state Sn0n\ket{S}_n\ket{0}_n, while bS,ib_{S, i} represents an arbitrary probability amplitude of a state Snin\ket{S}_n \ket{i}_n (any values are permitted).

Constraints

  • 1n51 \leq n \leq 5
  • The circuit depth must not exceed 88.
  • Global phase is ignored in judge.
  • The submitted code must follow the specified format:
from qiskit import QuantumCircuit
 
 
def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(2 * n)
    # Write your code here:
 
    return qc

Sample Input

  • n=1n = 1: Implemented circuit qc\mathrm{qc} should perform the following transformation.
a000+a110qc13{(a0+a1)00+a110+a001(a0a1)11}\begin{equation} a_0 \ket {00} + a_1 \ket {10} \xrightarrow{\mathrm{qc}} \frac{1}{\sqrt{3}} \lbrace (a_0 + a_1) \ket{00} + a_1 \ket{10} + a_0 \ket{01} - (a_0 -a_1) \ket{11} \rbrace \nonumber \end{equation}

Hints

Open
  • For subsets AA and BB of [n][n], "ABA \subseteq B" can be rephrased as "for any S[n]S \in [n], A{S}B{S}A \cap \lbrace S \rbrace \subseteq B \cap \lbrace S \rbrace".

Please sign in to submit your answer.