P1422 [CF1001H] Oracle for f(x) = parity of the number of 1s in x
普及-
题目描述

Implement a quantum oracle on N qubits which implements the following function: $$f(x) = \sum_{i} x_i \mod 2$$, i.e., the value of the function is 1 if x has odd number of 1s, and 0 otherwise.

Input

You have to implement an operation which takes the following inputs:

  • an array of qubits x (input register),
  • a qubit y (output qubit).

The operation doesn't have an output; the "output" of your solution is the state in which it left the qubits.

Your code should have the following signature:

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
793505 1
样例输出
Test passed