A4: Cyclic Shift Oracle II

実行時間制限:3 秒

メモリ制限:512 MiB

配点:200点

問題文

整数 nn が入力として与えられる。

xn1=0x_{n-1} = 0 を満たす任意の長さ nn のビット列 x0x1xn1x_0 x_1 \cdots x_{n-1} に対して、次式の操作を nn 量子ビットをもつ量子回路 qc\mathrm{qc} 上に実装せよ。

x0x1xn1nqcxn1x0x1xn2n\begin{equation} \ket{x_0 x_1 \cdots x_{n-1}}_n \xrightarrow{\mathrm{qc}} \ket{x_{n-1} x_0 x_1 \cdots x_{n-2}}_n \nonumber \end{equation}

制約

  • 2n102 \leq n \leq 10
  • 量子回路の 深さ2020 を超えてはならない。
  • グローバル位相 は問わない。
  • この問題では Qiskit の SwapGate を利用してはならない。
  • 提出されるコードは次のフォーマットにしたがうこと
from qiskit import QuantumCircuit
 
 
def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
 
    return qc

入力例

  • n=2n = 2: 実装された量子回路 qc\mathrm{qc} は次式を満たす。 {00qc0010qc01\begin{equation} \begin{cases} \ket {00} \xrightarrow{\mathrm{qc}} \ket{00} \\ \ket {10} \xrightarrow{\mathrm{qc}} \ket{01} \\ \end{cases} \nonumber \end{equation}

解答を提出するにはログインしてください。