codeforces-scrape

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

1001C.md (1257B)


      1 Source: https://codeforces.com/problemset/problem/1001/C
      2 
      3 C. Generate GHZ state
      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 (1 ≤ *N* ≤ 8) in zero state ![](https://espresso.codeforces.com/8bb67080da7081bfb802ca6ecc5abc4f4c5ca190.png). Your task is to create Greenberger–Horne–Zeilinger (GHZ) state on them:
     22 
     23 ![](https://espresso.codeforces.com/acb08ce15c611d90dc85f731accccd9bbfac8fd3.png)
     24 
     25 Note that for *N* = 1 and *N* = 2 GHZ state becomes states ![](https://espresso.codeforces.com/891b1e75c93e44f237b7fde497062f8e85c1d952.png) and ![](https://espresso.codeforces.com/aec27febc80bfeb882cb96d33386f048ce011703.png) from the previous tasks, respectively.
     26 
     27 Input
     28 
     29 You have to implement an operation which takes an array of *N* qubits as an input and has no output. The "output" of your solution is the state in which it left the input qubits.
     30 
     31 Your code should have the following signature:
     32 
     33 ```
     34 namespace Solution {  
     35     open Microsoft.Quantum.Primitive;  
     36     open Microsoft.Quantum.Canon;  
     37   
     38     operation Solve (qs : Qubit[]) : ()  
     39     {  
     40         body  
     41         {  
     42             // your code here  
     43         }  
     44     }  
     45 }
     46 ```