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

Microsoft Q# Coding Contest - Summer 2018 - Warmup:

- 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

F. Distinguish multi-qubit basis states

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given *N* qubits which are guaranteed to be in one of two basis states on *N* qubits. You are also given two bitstrings *bits*0 and *bits*1 which describe these basis states.

Your task is to perform necessary operations and measurements to figure out which state it was and to return 0 if it was the state described with *bits*0 or 1 if it was the state described with *bits*1. The state of the qubits after the operations does not matter.

Input

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

- an array of qubits
*qs*, - two arrays of boolean values
*bits*0 and*bits*1, representing the basis states in which the qubits can be. These arrays will have the same length as the array of qubits.*bits*0 and*bits*1 will differ in at least one position.

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 .

Your code should have the following signature:

namespace Solution {

open Microsoft.Quantum.Primitive;

open Microsoft.Quantum.Canon;

operation Solve (qs : Qubit[], bits0 : Bool[], bits1 : Bool[]) : Int

{

body

{

// your code here

}

}

}

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jan/20/2019 19:24:56 (f1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|