{"problem":{"name":"A. Generate plus state or minus state","description":{"content":"You are given a qubit in state and an integer _sign_. Your task is to convert the given qubit to state if _sign_ = 1 or if _sign_ =  - 1.","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF1001A"},"statements":[{"statement_type":"Markdown","content":"You are given a qubit in state and an integer _sign_.\n\nYour task is to convert the given qubit to state if _sign_ = 1 or if _sign_ =  - 1.\n\n## Input\n\nYou have to implement an operation which takes a qubit and an integer as an input and has no output. The \"output\" of your solution is the state in which it left the input qubit.\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 (q : Qubit, sign : Int) : ()\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[sign]。\n\n你的任务是：如果 #cf_span[sign = 1]，将该量子比特转换为状态 ；如果 #cf_span[sign =  - 1]，将其转换为状态 。\n\n你需要实现一个操作，该操作以一个量子比特和一个整数作为输入，且无输出。你的解决方案的“输出”是其作用后量子比特所处的状态。\n\n你的代码应具有以下签名：\n\n## Input\n\n你需要实现一个操作，该操作以一个量子比特和一个整数作为输入，且无输出。你的解决方案的“输出”是其作用后量子比特所处的状态。你的代码应具有以下签名：namespace Solution {    open Microsoft.Quantum.Primitive;    open Microsoft.Quantum.Canon;    operation Solve (q : Qubit, sign : Int) : ()    {        body        {            // your code here        }    }}\n\n[samples]","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $|\\psi\\rangle = \\alpha |0\\rangle + \\beta |1\\rangle$ be the initial state of a qubit, with $\\alpha, \\beta \\in \\mathbb{C}$ and $|\\alpha|^2 + |\\beta|^2 = 1$.  \nLet $s \\in \\{ -1, 1 \\}$ be an integer sign parameter.\n\n**Constraints**  \n1. $|\\alpha|^2 + |\\beta|^2 = 1$  \n2. $s = 1$ or $s = -1$\n\n**Objective**  \nApply a unitary operation such that the final state of the qubit is:  \n$$\n|\\psi_{\\text{final}}\\rangle = \n\\begin{cases}\n|0\\rangle & \\text{if } s = 1 \\\\\n|1\\rangle & \\text{if } s = -1\n\\end{cases}\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF1001A","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}