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

Microsoft Q# Coding Contest - Winter 2019 - 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 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

The problem statement has recently been changed. View the changes.

×
G3. Palindrome checker oracle

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputImplement a quantum oracle on $$$N$$$ qubits which checks whether the vector $$$\vec{x}$$$ is a palindrome (i.e., implements the function $$$f(\vec{x}) = 1$$$ if $$$\vec{x}$$$ is a palindrome, and 0 otherwise).

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

- an array of $$$N$$$ ($$$1 \le N \le 8$$$) qubits $$$x$$$ in an arbitrary state (input register),
- a qubit $$$y$$$ in an arbitrary state (output qubit),

and performs a transformation $$$|x\rangle|y\rangle \rightarrow |x\rangle|y \oplus f(x)\rangle$$$. 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 (x : Qubit[], y : Qubit) : Unit {

body (...) {

// your code here

}

adjoint auto;

}

}

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/22/2021 16:54:08 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|