codeforces-scrape

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

1001F.md (1795B)


      1 Source: https://codeforces.com/problemset/problem/1001/F
      2 
      3 F. Distinguish multi-qubit basis states
      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 You are given *N* qubits which are guaranteed to be in one of two basis states on *N* qubits. You are also given two bitstrings *bits*0 and *bits*1 which describe these basis states.
     22 
     23 Your task is to perform necessary operations and measurements to figure out which state it was and to return 0 if it was the state described with *bits*0 or 1 if it was the state described with *bits*1. The state of the qubits after the operations does not matter.
     24 
     25 Input
     26 
     27 You have to implement an operation which takes the following inputs:
     28 
     29 * an array of qubits *qs*,
     30 * two arrays of boolean values *bits*0 and *bits*1, representing the basis states in which the qubits can be. These arrays will have the same length as the array of qubits. *bits*0 and *bits*1 will differ in at least one position.
     31 
     32 An array of boolean values represents a basis state as follows: the *i*-th element of the array is true if the *i*-th qubit is in state ![](https://espresso.codeforces.com/08c9f8a718e14660a9d064a4b3c11e6340bef9c4.png), and false if it is in state ![](https://espresso.codeforces.com/c1f9019c20fc8a9610d31c36ba7860cef0b7c55c.png). For example, array [true; false] describes 2-qubit state ![](https://espresso.codeforces.com/8cd708066f09a8d46d85c4f2f1fb2e1d9977813b.png).
     33 
     34 Your code should have the following signature:
     35 
     36 ```
     37 namespace Solution {  
     38     open Microsoft.Quantum.Primitive;  
     39     open Microsoft.Quantum.Canon;  
     40   
     41     operation Solve (qs : Qubit[], bits0 : Bool[], bits1 : Bool[]) : Int  
     42     {  
     43         body  
     44         {  
     45             // your code here  
     46         }  
     47     }  
     48 }
     49 ```