B1: Polynomial Oracle

Time Limit: 3 seconds

Memory Limit: 512 MiB

Score: 300 points

Problem Statement

For an integer x  (0x<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}.

The oracle OO acts on basis states xy\ket{x}\ket{y}, where 0x<80 \leq x < 8 and 0y<80 \leq y < 8, as follows:

xyOxyf(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=135(mod8)f(3) = 3^2 + 3 + 1 = 13 \equiv 5 \pmod{8}.

Please sign in to submit your answer.