Problem Statement
You are given integers n, m, S0, S1, ⋯, Sn−1.
For an integer x=x0+21x1+⋯2n−1xn−1 (xi∈{0,1}) where 0≤x<2n, define the function f(x) by
f(x)=S0x0+S1x1+⋯+Sn−1xn−1.
Implement the n-qubit oracle O acting on computational basis states as
∣x⟩nOexp(2m2πif(x))∣x⟩n
for any integer x such that 0≤x<2n.
Constraints
- 1≤n,m≤10
- 0≤Sk<2m
- The circuit depth must not exceed 10.
- Integers must be encoded by little-endian notation, i.e., ∣100⟩=1=∣001⟩.
- Global phase is ignored in judge.
- The submitted code must follow the specified format:
Sample Input
- n=2, m=2, S0=1, S1=3, ∣x⟩=∣11⟩=∣3⟩:
Since f(3)=1⋅1+3⋅1=4, Implemented circuit qc should perform the following transformation.
∣11⟩qcexp(222⋅4πi)∣11⟩