P1419 [CF1001E] Distinguish Bell states
普及+
题目描述

You are given two qubits which are guaranteed to be in one of the Bell states:

  • $${ \left| B_{ 0 } \right\rangle } = { \frac { 1 } { \sqrt { 2 } } } ( { \left| 0 0 \right\rangle } + { \left| 1 1 \right\rangle } )$$
  • $${ \left| B _ { 1 } \right\rangle } = { \frac { 1 } { \sqrt { 2 } } } ( { \left| 0 0 \right\rangle } - { \left| 1 1 \right\rangle } )$$
  • $${ \left| B_{ 2 } \right\rangle } = { \frac { 1 } { \sqrt { 2 } } } ( { \left| 0 1 \right\rangle } + { \left| 1 0 \right\rangle } )$$
  • $${ \left| B_{ 3 } \right\rangle } = { \frac { 1 } { \sqrt { 2 } } } ( { \left| 0 1 \right\rangle } - { \left| 1 0 \right\rangle } )$$

Your task is to perform necessary operations and measurements to figure out which state it was and to return the index of that state (0 for $$| B_{0} \rangle$$, 1 for $$\left|B_{1}\right\rangle$$ etc.). The state of the qubits after the operations does not matter.

Input

You have to implement an operation which takes an array of two qubits as an input and returns an integer.

Your code should have the following signature:

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
834135
样例输出
Test passed