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

D4. TIE fighter

time limit per test

2 secondsmemory limit per test

1024 megabytesinput

standard inputoutput

standard outputImplement a unitary operation on $$$N$$$ qubits which is represented by a square matrix of size $$$2^N$$$ which has non-zero elements in the following positions:

- the central 2x2 sub-matrix,
- the diagonals of the top right and bottom left square sub-matrices of size $$$2^{N-1}-1$$$ that do not overlap with the central 2x2 sub-matrix,
- the anti-diagonals of the top left and bottom right square sub-matrices of size $$$2^{N-1}-1$$$ that do not overlap with the central 2x2 sub-matrix.

For example, for $$$N = 3$$$ the matrix of the operation should have the following shape:

..X..X..

.X....X.

X......X

...XX...

...XX...

X......X

.X....X.

..X..X..

Here X denotes a "non-zero" element of the matrix (a complex number which has the square of the absolute value greater than or equal to $$$10^{-5}$$$), and . denotes a "zero" element of the matrix (a complex number which has the square of the absolute value less than $$$10^{-5}$$$).

The row and column indices of the matrix follow little endian format: the least significant bit of the index is stored first in the qubit array. Thus, the first column of the matrix gives you the coefficients of the basis states you'll get if you apply the unitary to the $$$|00..0\rangle$$$ basis state, the second column - to the $$$|10..0\rangle$$$ basis state etc. You can use the DumpUnitary tool to get the coefficients of the matrix your unitary implements (up to relative phases between columns) and the corresponding pattern of Xs and .s.

You have to implement an operation which takes an array of $$$N$$$ ($$$2 \le N \le 5$$$) qubits as an input and applies the unitary transformation with the matrix of the described shape to it. If there are multiple unitaries which satisfy the requirements, you can implement any of them. The "output" of your operation is the pattern of the matrix coefficients implemented by it; you can see the testing harness in the UnitaryPatterns kata.

Your code should have the following signature:

namespace Solution {

open Microsoft.Quantum.Primitive;

open Microsoft.Quantum.Canon;

operation Solve (qs : Qubit[]) : Unit {

// your code here

}

}

You are not allowed to use measurements in your operation.

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jan/24/2020 15:30:49 (f1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|