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

Microsoft Q# Coding Contest - Summer 2018:

- 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 ACM-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 tag edit access

A2. Generate superposition of zero state and a basis state

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given *N* qubits (1 ≤ *N* ≤ 8) in zero state . You are also given a bitstring *bits* which describes a non-zero basis state on *N* qubits .

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

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

- an array of qubits
*qs*, - an arrays of boolean values
*bits*representing the basis state . This array will have the same length as the array of qubits. The first element of this array*bits*[0] will be true.

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

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 , and false if it is in state . For example, array [true; false] describes 2-qubit state , and in this case the resulting state should be .

Your code should have the following signature:

namespace Solution {

open Microsoft.Quantum.Primitive;

open Microsoft.Quantum.Canon;

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

{

body

{

// your code here

}

}

}

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Nov/21/2018 12:06:52 (d1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|