B1: Polynomial Oracle

Time Limit: 3 seconds

Memory Limit: 512 MiB

Score: 300 points

Problem Statement

For an integer x  (0≤x<8)x \; (0 \leq x < 8), define f(x)=x2+x+1(mod8)f(x) = x^2 + x + 1 \pmod{8}.

Implement an 66-qubit oracle OO on a quantum circuit qc\mathrm{qc}.

For any pair of integers (x,y)(x,y) satisfying 0≤x<80 \leq x < 8 and 0≤y<80 \leq y < 8, the required transformation is as follows:

∣x⟩∣y⟩→O∣x⟩∣y⊕f(x)⟩\ket{x}\ket{y} \xrightarrow{O} \ket{x}\ket{y \oplus f(x)}

Here, ⊕\oplus denotes the bitwise XOR operator.

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, QuantumRegister
 
 
def solve() -> QuantumCircuit:
    x = QuantumRegister(3)
    y = QuantumRegister(3)
    qc = QuantumCircuit(x, y)
 
    # Write your code here:
 
    return qc

Hints

Open
  • For example, when x=3x = 3, we have f(3)=32+3+1=13≡5(mod8)f(3) = 3^2 + 3 + 1 = 13 \equiv 5 \pmod{8}.

Please sign in to submit your answer.