Preparando MOJI

Distinguish I, CNOTs and SWAP

1000ms 262144K

Description:

You are given an operation that implements a two-qubit unitary transformation: either the identity (I ⊗ I gate), the CNOT gate (either with the first qubit as control and the second qubit as target or vice versa) or the SWAP gate. The operation will have Adjoint and Controlled variants defined.

Your task is to perform necessary operations and measurements to figure out which unitary it was and to return

  • 0 if it was the I ⊗ I gate,
  • 1 if it was the CNOT$$$_{12}$$$ gate,
  • 2 if it was the CNOT$$$_{21}$$$ gate,
  • 3 if it was the SWAP gate.

You are allowed to apply the given operation and its adjoint/controlled variants at most twice.

You have to implement an operation which takes a two-qubit operation unitary as an input and returns an integer. The operation unitary will accept an array of qubits as input, but it will fail if the array is empty or has one or more than two qubits. Your code should have the following signature:

namespace Solution {
open Microsoft.Quantum.Intrinsic;

operation Solve (unitary : (Qubit[] => Unit is Adj+Ctl)) : Int {
// your code here
}
}

Informação

Codeforces

Provedor Codeforces

Código CF1357A2

Tags

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 10:02:33

Relacionados

Nada ainda