1002D1.md (1457B)
1 Source: https://codeforces.com/problemset/problem/1002/D1 2 3 D1. Oracle for f(x) = b * x mod 2 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Implement a quantum oracle on *N* qubits which implements the following function: , where  (a vector of *N* integers, each of which can be 0 or 1). 22 23 For an explanation on how this type of quantum oracles works, see [Introduction to quantum oracles](https://codeforces.com/blog/entry/60319). 24 25 You have to implement an operation which takes the following inputs: 26 27 * an array of *N* qubits *x* in arbitrary state (input register), 1 ≤ *N* ≤ 8, 28 * a qubit *y* in arbitrary state (output qubit), 29 * an array of *N* integers *b*, representing the vector . Each element of *b* will be 0 or 1. 30 31 The operation doesn't have an output; its "output" is the state in which it leaves the qubits. 32 33 Your code should have the following signature: 34 35 ``` 36 namespace Solution { 37 open Microsoft.Quantum.Primitive; 38 open Microsoft.Quantum.Canon; 39 40 operation Solve (x : Qubit[], y : Qubit, b : Int[]) : () 41 { 42 body 43 { 44 // your code here 45 } 46 } 47 } 48 ```