codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1115G2.md (1045B)


      1 Source: https://codeforces.com/problemset/problem/1115/G2
      2 
      3 G2. OR oracle
      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: $$f(\vec{x}) = x_0 \vee x_1 \vee \dotsb \vee x_{N-1}$$
     22 
     23 You have to implement an operation which takes the following inputs:
     24 
     25 * an array of $N$ ($1 \le N \le 8$) qubits $x$ in an arbitrary state (input register),
     26 * a qubit $y$ in an arbitrary state (output qubit),
     27 
     28 and performs a transformation $|x\rangle|y\rangle \rightarrow |x\rangle|y \oplus f(x)\rangle$. The operation doesn't have an output; its "output" is the state in which it leaves the qubits.
     29 
     30 Your code should have the following signature:
     31 
     32 ```
     33 namespace Solution {  
     34     open Microsoft.Quantum.Primitive;  
     35     open Microsoft.Quantum.Canon;  
     36   
     37     operation Solve (x : Qubit[], y : Qubit) : Unit {  
     38         body (...) {  
     39             // your code here  
     40         }  
     41         adjoint auto;  
     42     }  
     43 }
     44 ```