The following languages are only available languages for the problems from the contest

Microsoft Q# Coding Contest - Winter 2019:

- Microsoft Q#

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tags yet

No tag edit access

A2. Generate equal superposition of four basis states

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given $$$N$$$ qubits in the zero state $$$|0...0 \rangle$$$. You are also given four distinct bit vectors which describe four different basis states on $$$N$$$ qubits $$$|\psi_i \rangle$$$.

Your task is to generate a state which is an equal superposition of the given basis states:

$$$$$$|S \rangle = \frac{1}{2} \big( |\psi_0 \rangle + |\psi_1 \rangle + |\psi_2 \rangle + |\psi_3 \rangle \big)$$$$$$

You have to implement an operation which takes the following inputs:

- an array of $$$N$$$ ($$$2 \le N \le 16$$$) qubits,
- a two-dimensional array of Boolean values $$$bits$$$ representing the basis states $$$|\psi_i \rangle$$$. $$$bits$$$ will have exactly 4 elements, each of $$$bits[i]$$$ describing the basis state $$$|\psi_i \rangle$$$. Each of $$$bits[i]$$$ will have $$$N$$$ elements, $$$bits[i][j]$$$ giving the state of qubit $$$j$$$ in the basis state $$$|\psi_i \rangle$$$. Bit values true and false corresponding to $$$|1 \rangle$$$ and $$$|0 \rangle$$$ states, respectively; for example, for $$$N = 2$$$ an array [false, true] will represent the basis state $$$|01\rangle$$$. Each pair of $$$bits[i]$$$ and $$$bits[j]$$$ will differ in at least one position for $$$i \neq j$$$.

The operation doesn't have an output; its "output" is the state in which it leaves the qubits.

Your code should have the following signature:

namespace Solution {

open Microsoft.Quantum.Primitive;

open Microsoft.Quantum.Canon;

operation Solve (qs : Qubit[], bits : Bool[][]) : Unit {

// your code here

}

}

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jan/22/2020 12:35:51 (f3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|