{"problem":{"name":"B4. Distinguish four 2-qubit states - 2","description":{"content":"You are given 2 qubits which are guaranteed to be in one of the four orthogonal states: Your task is to perform necessary operations and measurements to figure out which state it was and to return th","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF1002B4"},"statements":[{"statement_type":"Markdown","content":"You are given 2 qubits which are guaranteed to be in one of the four orthogonal states:\n\nYour 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 , 1 for etc.). The state of the qubits after the operations does not matter.\n\nYou have to implement an operation which takes an array of 2 qubits as an input and returns an integer.\n\nYour code should have the following signature:\n\nnamespace Solution {\n    open Microsoft.Quantum.Primitive;\n    open Microsoft.Quantum.Canon;\n\n    operation Solve (qs : Qubit\\[\\]) : Int\n    {\n        body\n        {\n            // your code here\n        }\n    }\n}\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"给定两个量子比特，它们保证处于以下四个正交态之一：\n\n你的任务是执行必要的操作和测量，以确定其处于哪个态，并返回该态的索引（0 对应 ，1 对应 ，依此类推）。操作后量子比特的状态无关紧要。\n\n你需要实现一个操作，该操作以包含 2 个量子比特的数组作为输入，并返回一个整数。\n\n你的代码应具有以下签名：\n\n[samples]","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $\\mathcal{H} = \\mathbb{C}^2 \\otimes \\mathbb{C}^2$ be the Hilbert space of two qubits.  \nLet $\\{|\\psi_0\\rangle, |\\psi_1\\rangle, |\\psi_2\\rangle, |\\psi_3\\rangle\\} \\subset \\mathcal{H}$ be a fixed set of four mutually orthogonal quantum states.\n\n**Given**  \nAn input state $|\\psi\\rangle \\in \\{|\\psi_0\\rangle, |\\psi_1\\rangle, |\\psi_2\\rangle, |\\psi_3\\rangle\\}$, prepared in a 2-qubit register.\n\n**Objective**  \nDesign a quantum circuit (unitary operations and measurement) that, given $|\\psi\\rangle$, outputs the index $i \\in \\{0,1,2,3\\}$ such that $|\\psi\\rangle = |\\psi_i\\rangle$, with certainty.  \n\nThe operation must return $i$ as an integer, based on measurement outcomes of the 2-qubit system.  \n\n**Constraints**  \n- Only unitary operations and projective measurements in the computational basis are permitted.  \n- The final state of the qubits after measurement is irrelevant.  \n- The distinguishing protocol must succeed with probability 1 for all four possible input states.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF1002B4","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}