{"problem":{"name":"F. Distinguish multi-qubit basis states","description":{"content":"You are given _N_ qubits which are guaranteed to be in one of two basis states on _N_ qubits. You are also given two bitstrings _bits_0 and _bits_1 which describe these basis states. Your task is to ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF1001F"},"statements":[{"statement_type":"Markdown","content":"You are given _N_ qubits which are guaranteed to be in one of two basis states on _N_ qubits. You are also given two bitstrings _bits_0 and _bits_1 which describe these basis states.\n\nYour task is to perform necessary operations and measurements to figure out which state it was and to return 0 if it was the state described with _bits_0 or 1 if it was the state described with _bits_1. The state of the qubits after the operations does not matter.\n\n## Input\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 in which the qubits can be. 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\nAn array of boolean values represents a basis state as follows: the _i_\\-th element of the array is true if the _i_\\-th qubit is in state , and false if it is in state . For example, array \\[true; false\\] describes 2-qubit state .\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\\[\\]) : 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[N] 个量子比特，它们保证处于以下两种基态之一：#cf_span[N] 个量子比特的两种基态。你还被给定两个比特串 #cf_span[bits0] 和 #cf_span[bits1]，它们描述了这两种基态。\n\n你的任务是执行必要的操作和测量，以确定当前处于哪种状态，并在状态为 #cf_span[bits0] 描述的状态时返回 0，在状态为 #cf_span[bits1] 描述的状态时返回 1。操作后量子比特的状态无关紧要。\n\n你需要实现一个操作，它接收以下输入：\n\n一个布尔值数组，以如下方式表示基态：数组的第 #cf_span[i] 个元素为 true 表示第 #cf_span[i] 个量子比特处于 状态，false 表示处于 状态。例如，数组 [true; false] 描述的是 2-量子比特状态 。\n\n## Input\n\n你需要实现一个操作，它接收以下输入：一个量子比特数组 #cf_span[qs]，以及两个布尔值数组 #cf_span[bits0] 和 #cf_span[bits1]，分别表示量子比特可能处于的基态。这些数组的长度与量子比特数组相同。#cf_span[bits0] 和 #cf_span[bits1] 至少在一个位置上不同。一个布尔值数组以如下方式表示基态：数组的第 #cf_span[i] 个元素为 true 表示第 #cf_span[i] 个量子比特处于 状态，false 表示处于 状态。例如，数组 [true; false] 描述的是 2-量子比特状态 。你的代码应具有以下签名：namespace Solution {    open Microsoft.Quantum.Primitive;    open Microsoft.Quantum.Canon;    operation Solve (qs : Qubit[], bits0 : Bool[], bits1 : Bool[]) : Int    {        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 $ b_0, b_1 \\in \\{0,1\\}^N $ be two distinct bitstrings representing orthonormal computational basis states:  \n- $ b_0 = (b_{0,1}, b_{0,2}, \\dots, b_{0,N}) $, where $ b_{0,i} \\in \\{0,1\\} $  \n- $ b_1 = (b_{1,1}, b_{1,2}, \\dots, b_{1,N}) $, where $ b_{1,i} \\in \\{0,1\\} $  \n\nThe system is prepared in one of the two states: $ |b_0\\rangle $ or $ |b_1\\rangle $.\n\n**Constraints**  \n1. $ b_0 \\ne b_1 $  \n2. The input state is guaranteed to be exactly $ |b_0\\rangle $ or $ |b_1\\rangle $ (no superposition or noise).\n\n**Objective**  \nDesign a quantum operation that, given access to a single copy of the unknown state $ |\\psi\\rangle \\in \\{ |b_0\\rangle, |b_1\\rangle \\} $, outputs:  \n$$\n\\begin{cases}\n0 & \\text{if } |\\psi\\rangle = |b_0\\rangle \\\\\n1 & \\text{if } |\\psi\\rangle = |b_1\\rangle\n\\end{cases}\n$$  \nusing quantum gates and measurement in the computational basis. The final state of the qubits after measurement is irrelevant.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF1001F","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}