codeforces-scrape

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

1002B4.md (1419B)


      1 Source: https://codeforces.com/problemset/problem/1002/B4
      2 
      3 B4. Distinguish four 2-qubit states - 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 You are given 2 qubits which are guaranteed to be in one of the four orthogonal states:
     22 
     23 * ![](https://espresso.codeforces.com/49e51a6f9be9e5bedeabaa7ca5e7bd92dcc1ab5d.png)
     24 * ![](https://espresso.codeforces.com/95e233a39166d0267c91286fe4cf12ae7304c729.png)
     25 * ![](https://espresso.codeforces.com/7879ef981f7a9e5d0558b430f38eb6d9948ac4cd.png)
     26 * ![](https://espresso.codeforces.com/a982638d2f4b65b45c549e6cd5dad0b1a647e8dc.png)
     27 
     28 Your task is to perform necessary operations and measurements to figure out which state it was and to return the index of that state (0 for ![](https://espresso.codeforces.com/afa7acae20d2fab7a9f92e874117fe5110a64bec.png), 1 for ![](https://espresso.codeforces.com/af50cdeb431e258f308aab43ec055f87a0fd8827.png) etc.). The state of the qubits after the operations does not matter.
     29 
     30 You have to implement an operation which takes an array of 2 qubits as an input and returns an integer.
     31 
     32 Your code should have the following signature:
     33 
     34 ```
     35 namespace Solution {  
     36     open Microsoft.Quantum.Primitive;  
     37     open Microsoft.Quantum.Canon;  
     38   
     39     operation Solve (qs : Qubit[]) : Int  
     40     {  
     41         body  
     42         {  
     43             // your code here  
     44         }  
     45     }  
     46 }
     47 ```