Upload code_segments/segment_408.txt with huggingface_hub
Browse files
code_segments/segment_408.txt
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This is an interactive problem.
|
2 |
+
|
3 |
+
The Department of Supernatural Phenomena at the Oxenfurt Academy has opened the Library of Magic, which contains the works of the greatest sorcerers of Redania — $n$ ($3 \leq n \leq 10^{18}$) types of books, numbered from $1$ to $n$. Each book's type number is indicated on its spine. Moreover, each type of book is stored in the library in exactly two copies! And you have been appointed as the librarian.
|
4 |
+
|
5 |
+
One night, you wake up to a strange noise and see a creature leaving the building through a window. Three thick tomes of different colors were sticking out of the mysterious thief's backpack. Before you start searching for them, you decide to compute the numbers $a$, $b$, and $c$ written on the spines of these books. All three numbers are distinct.
|
6 |
+
|
7 |
+
So, you have an unordered set of tomes, which includes one tome with each of the pairwise distinct numbers $a$, $b$, and $c$, and two tomes for all numbers from $1$ to $n$, except for $a$, $b$, and $c$. You want to find these values $a$, $b$, and $c$.
|
8 |
+
|
9 |
+
Since you are not working in a simple library, but in the Library of Magic, you can only use one spell in the form of a query to check the presence of books in their place:
|
10 |
+
|
11 |
+
* "xor l r" — Bitwise XOR query with parameters $l$ and $r$. Let $k$ be the number of such tomes in the library whose numbers are greater than or equal to $l$ and less than or equal to $r$. You will receive the result of the computation $v_1 \oplus v_2 \oplus ... \oplus v_k$, where $v_1 ... v_k$ are the numbers on the spines of these tomes, and $\oplus$ denotes the operation of [bitwise exclusive OR](http://tiny.cc/xor_wiki_eng).
|
12 |
+
|
13 |
+
Since your magical abilities as a librarian are severely limited, you can make no more than $150$ queries.
|
14 |
+
|
15 |
+
The first line of input contains an integer $t$ ($1 \le t \le 300$) — the number of test cases.
|
16 |
+
|
17 |
+
The first line of each test case contains a single integer $n$ ($3 \leq n \leq 10^{18}$) — the number of types of tomes.
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
In the first test case, the books in the library afte
|