{"problem":{"name":"H. Oracle for f(x) = parity of the number of 1s in x","description":{"content":"Implement a quantum oracle on _N_ qubits which implements the following function: , i.e., the value of the function is 1 if _x_ has odd number of 1s, and 0 otherwise.","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF1001H"},"statements":[{"statement_type":"Markdown","content":"Implement a quantum oracle on _N_ qubits which implements the following function: , i.e., the value of the function is 1 if _x_ has odd number of 1s, and 0 otherwise.\n\n## Input\n\nYou have to implement an operation which takes the following inputs:\n\n*   an array of qubits _x_ (input register),\n*   a qubit _y_ (output qubit).\n\nThe operation doesn't have an output; the \"output\" of your solution is the state in which it left 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 (x : Qubit\\[\\], y : 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[x] 中包含奇数个 1 时，函数值为 1，否则为 0。\n\n你需要实现一个操作，该操作接收以下输入：\n\n该操作没有输出；你的解决方案的“输出”是其最终留下的量子比特状态。\n\n你的代码应具有以下签名：\n\n## Input\n\n你需要实现一个操作，该操作接收以下输入：一组量子比特 #cf_span[x]（输入寄存器），一个量子比特 #cf_span[y]（输出量子比特）。该操作没有输出；你的解决方案的“输出”是其最终留下的量子比特状态。你的代码应具有以下签名：namespace Solution {    open Microsoft.Quantum.Primitive;    open Microsoft.Quantum.Canon;    operation Solve (x : Qubit[], y : Qubit) : ()    {        body        {            // your code here        }    }}\n\n[samples]","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ N \\in \\mathbb{Z}^+ $ be the number of qubits.  \nLet $ \\mathcal{H} = (\\mathbb{C}^2)^{\\otimes N} $ be the Hilbert space of $ N $ qubits.  \nLet $ |x\\rangle \\in \\mathcal{H} $ denote a computational basis state corresponding to an $ N $-bit string $ x \\in \\{0,1\\}^N $.  \n\nLet $ f: \\{0,1\\}^N \\to \\{0,1\\} $ be the parity function:  \n$$\nf(x) = \\bigoplus_{i=1}^N x_i = \\text{parity}(x) = \n\\begin{cases}\n1 & \\text{if } |x|_1 \\text{ is odd} \\\\\n0 & \\text{otherwise}\n\\end{cases}\n$$\n\n**Objective**  \nImplement a unitary operator $ U_f: \\mathcal{H} \\to \\mathcal{H} $ such that for all $ |x\\rangle \\in \\{0,1\\}^N $:  \n$$\nU_f |x\\rangle = (-1)^{f(x)} |x\\rangle\n$$\n\n**Constraints**  \n- The operation acts only on the $ N $ input qubits.  \n- No ancilla qubits may be used unless explicitly permitted (assumed not allowed).  \n- The implementation must be exact and unitary.  \n- The \"output\" is the final state of the qubits; no measurement is performed.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF1001H","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}