codeforces-scrape

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

1002C1.md (1675B)


      1 Source: https://codeforces.com/problemset/problem/1002/C1
      2 
      3 C1. Distinguish zero state and plus state with minimum error
      4 
      5 time limit per test
      6 
      7 2 seconds
      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 a qubit which is guaranteed to be either in ![](https://espresso.codeforces.com/c1f9019c20fc8a9610d31c36ba7860cef0b7c55c.png) state or in ![](https://espresso.codeforces.com/d92593c6760aba7602b98b147630fe99f3ba55f1.png) state.
     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 a ![](https://espresso.codeforces.com/c1f9019c20fc8a9610d31c36ba7860cef0b7c55c.png) state or 1 if it was ![](https://espresso.codeforces.com/891b1e75c93e44f237b7fde497062f8e85c1d952.png) state. The state of the qubit after the operations does not matter.
     24 
     25 Note that these states are not orthogonal, and thus can not be distinguished perfectly. In each test your solution will be called 1000 times, and your goal is to get a correct answer at least 80% of the times. In each test ![](https://espresso.codeforces.com/c1f9019c20fc8a9610d31c36ba7860cef0b7c55c.png) and ![](https://espresso.codeforces.com/891b1e75c93e44f237b7fde497062f8e85c1d952.png) states will be provided with 50% probability.
     26 
     27 You have to implement an operation which takes a qubit as an input and returns an integer.
     28 
     29 Your code should have the following signature:
     30 
     31 ```
     32 namespace Solution {  
     33     open Microsoft.Quantum.Primitive;  
     34     open Microsoft.Quantum.Canon;  
     35   
     36     operation Solve (q : Qubit) : Int  
     37     {  
     38         body  
     39         {  
     40             // your code here  
     41         }  
     42     }  
     43 }
     44 ```