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+m)-qubit oracle O acting on computational basis states as
∣x⟩n∣0⟩mO∣x⟩n∣f(x) mod 2m⟩m
for any integer x such that 0≤x<2n.
Constraints
- 1≤n,m≤9
- n+m≤10
- 0≤Sk<2m
- The circuit depth must not exceed 50.
- 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: