Codeforces Round 1069 (Div. 2)
B
XOR Array
Codeforces
1300
原题
← AC →
翻译中…

You are given three integers $n$, $l$, and $r$.

翻译中…

You need to generate an array $a$ of positive ($1 \leq a_i \leq 10^9$) integers of length $n$. Let $f(x, y)$, for $1 \le x \le y \le n$, be the bitwise XOR$^{\text{∗}}$ value $a_x \oplus a_{x+1} \oplus \ldots \oplus a_y$. You need to make sure that $$\begin{cases} f(x, y) = 0\quad \text{when }x = l\text{ and }y = r; \text{and}\\ f(x, y) \ne 0\quad \text{when }x \ne l \text{ or } y \ne r. \end{cases}$$

翻译中…

$^{\text{∗}}$$\oplus$ denotes the bitwise XOR operation.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

翻译中…

The only line of each test case contains three integers $n$, $l$, and $r$ ($2 \leq n \leq 4\cdot 10^5$, $1 \leq l \lt r \leq n$).

翻译中…

It is guaranteed that the sum of $n$ across all test cases does not exceed $5\cdot 10^5$.

翻译中…

Output

翻译中…

For each test case, print a single line containing $n$ integers $a_1, a_2, \ldots a_n$.

翻译中…

We can show that an answer always exists. If there are multiple solutions, print any of them.

翻译中…

Note

翻译中…

In the first test case, $f(1, 3) = 9 \oplus 8 \oplus 1 = 0$, while all other non-empty subarrays have non-zero bitwise XOR:

翻译中…
  • $f(1, 2) = 9 \oplus 8 = 1 \ne 0$,
  • $f(2, 3) = 8 \oplus 1 = 9 \ne 0$,
  • $f(1, 1) = 9 \ne 0$,
  • $f(2, 2) = 8 \ne 0$,
  • $f(3, 3) = 1 \ne 0$.
翻译中…

In the second test case, $2 \oplus 7 \oplus 5 = 0$, while, for example, $7 \oplus 5 \oplus 4 = 6 \ne 0$.

翻译中…

样例

Input #1
4
3 1 3
4 1 3
8 2 4
4 3 4
Output #1
9 8 1
2 7 5 4
9 1 9 8 10 5 4 9
85484 130377 6031 6031
InputCopy OutputCopy
题目信息
题号
2175B
时间限制
1 s
内存限制
256 MB
标签
构造
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。