{"problem":{"name":"C. Generate GHZ state","description":{"content":"You are given _N_ qubits (1 ≤ _N_ ≤ 8) in zero state . Your task is to create Greenberger–Horne–Zeilinger (GHZ) state on them: Note that for _N_ = 1 and _N_ = 2 GHZ state becomes states and from the ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF1001C"},"statements":[{"statement_type":"Markdown","content":"You are given _N_ qubits (1 ≤ _N_ ≤ 8) in zero state . Your task is to create Greenberger–Horne–Zeilinger (GHZ) state on them:\n\nNote that for _N_ = 1 and _N_ = 2 GHZ state becomes states and from the previous tasks, respectively.\n\n## Input\n\nYou have to implement an operation which takes an array of _N_ qubits as an input and has no output. The \"output\" of your solution is the state in which it left the input 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\\[\\]) : ()\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]），它们均处于零态。你的任务是为它们构造一个 Greenberger–Horne–Zeilinger（GHZ）态：\n\n注意，当 #cf_span[N = 1] 和 #cf_span[N = 2] 时，GHZ 态分别变为前两道题中的态  和  。\n\n你需要实现一个操作，该操作以一个包含 #cf_span[N] 个量子比特的数组作为输入，且无输出。你的解法的“输出”是其作用后输入量子比特所处的状态。\n\n你的代码应具有以下签名：\n\n## Input\n\n你需要实现一个操作，该操作以一个包含 #cf_span[N] 个量子比特的数组作为输入，且无输出。你的解法的“输出”是其作用后输入量子比特所处的状态。你的代码应具有以下签名：namespace Solution {    open Microsoft.Quantum.Primitive;    open Microsoft.Quantum.Canon;    operation Solve (qs : Qubit[]) : ()    {        body        {            // your code here        }    }}\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 $ \\mathcal{H} = (\\mathbb{C}^2)^{\\otimes N} $ be the Hilbert space of $ N $ qubits.  \nLet $ |0\\rangle^{\\otimes N} $ denote the initial state of $ N $ qubits, all in the computational basis state $ |0\\rangle $.\n\n**Objective**  \nImplement a unitary operation $ U $ such that:  \n$$\nU |0\\rangle^{\\otimes N} = \\frac{1}{\\sqrt{2}} \\left( |0\\rangle^{\\otimes N} + |1\\rangle^{\\otimes N} \\right)\n$$  \nThis is the $ N $-qubit Greenberger–Horne–Zeilinger (GHZ) state.  \n\n**Constraints**  \n- The operation must act on exactly $ N $ qubits.  \n- The operation must be implemented using quantum gates (no classical post-processing or measurement-based state preparation).  \n- The operation has no output; the final state of the qubits is the result.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF1001C","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}