{"problem":{"name":"A3. Generate superposition of two basis states","description":{"content":"You are given _N_ qubits (1 ≤ _N_ ≤ 8) in zero state . You are also given two bitstrings _bits_0 and _bits_1 which describe two different basis states on _N_ qubits and . Your task is to generate a s","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF1002A3"},"statements":[{"statement_type":"Markdown","content":"You are given _N_ qubits (1 ≤ _N_ ≤ 8) in zero state . You are also given two bitstrings _bits_0 and _bits_1 which describe two different basis states on _N_ qubits and .\n\nYour task is to generate a state which is an equal superposition of the given basis states:\n\nYou have to implement an operation which takes the following inputs:\n\n*   an array of qubits _qs_,\n*   two arrays of Boolean values _bits_0 and _bits_1 representing the basis states and . These arrays will have the same length as the array of qubits. _bits_0 and _bits_1 will differ in at least one position.\n\nThe operation doesn't have an output; its \"output\" is the state in which it leaves the qubits.\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\\[\\], bits0 : Bool\\[\\], bits1 : Bool\\[\\]) : ()\n    {\n        body\n        {\n            // your code here\n        }\n    }\n}\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"给定 #cf_span[N] 个量子比特（#cf_span[1 ≤ N ≤ 8]），初始处于零态。同时给定两个比特串 #cf_span[bits0] 和 #cf_span[bits1]，它们描述了 #cf_span[N] 个量子比特上的两个不同基态。\n\n你的任务是生成一个状态，该状态是给定基态的等权重叠加：\n\n你需要实现一个操作，它接受以下输入：\n\n该操作没有输出；其“输出”是操作完成后量子比特所处的状态。\n\n你的代码应具有以下签名：\n\n[samples]","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ N \\in \\mathbb{Z} $ with $ 1 \\leq N \\leq 8 $.  \nLet $ |b_0\\rangle, |b_1\\rangle \\in \\{0,1\\}^N $ be two distinct computational basis states on $ N $ qubits.  \n\n**Given**  \nThe initial state of the system is $ |0\\rangle^{\\otimes N} $.  \n\n**Objective**  \nImplement a unitary operation that transforms the initial state into:  \n$$\n\\frac{1}{\\sqrt{2}} \\left( |b_0\\rangle + |b_1\\rangle \\right)\n$$  \n\n**Constraints**  \n- $ |b_0\\rangle \\neq |b_1\\rangle $  \n- The operation must be implemented using quantum gates on $ N $ qubits.  \n- No measurement is permitted; the output is the final quantum state.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF1002A3","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}