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

C2. Distinguish zero state and plus state without errors

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given a qubit which is guaranteed to be either in state or in state.

Your task is to perform necessary operations and measurements to figure out which state it was and to return 0 if it was a state, 1 if it was state or -1 if you can not decide, i.e., an "inconclusive" result. The state of the qubit after the operations does not matter.

Note that these states are not orthogonal, and thus can not be distinguished perfectly. In each test your solution will be called 10000 times, and your goals are:

- never give 0 or 1 answer incorrectly (i.e., never return 0 if input state was and never return 1 if input state was ),
- give -1 answer at most 80% of the times,
- correctly identify state at least 10% of the times,
- correctly identify state at least 10% of the times.

In each test and states will be provided with 50% probability.

You have to implement an operation which takes a qubit as an input and returns an integer.

Your code should have the following signature:

namespace Solution {

open Microsoft.Quantum.Primitive;

open Microsoft.Quantum.Canon;

operation Solve (q : Qubit) : Int

{

body

{

// your code here

}

}

}

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/20/2019 07:03:40 (d3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|