P8305 [CoE R4 E] Pseudorandom

Description

A very, very long time ago, Xiaoming generated some data. His data generator used the following two functions to generate random numbers: ```plain Define function srand(32-bit unsigned integer seed) Set x to seed Define function rand() Set x to x XOR (x left shift by 13 bits) Set x to x XOR (x right shift by 17 bits) Set x to x XOR (x left shift by 5 bits) Return x ``` After calling $\text{srand(seed)}$, Xiaoming called $\text{rand()}$ consecutively $n$ times, and recorded the remainder $a_i$ obtained by taking the return value of each $\text{rand()}$ modulo $p$. A very, very long time later, only the data generator still remains (see `generator.cpp` in the provided files), but the parameters $\text{seed}$ and $p$ have been lost. Xiaoming wants to recover these two parameters from the data. That is, given the sequence $a_i$, you need to find any possible values of $\text{seed}$ and $p$. Can you help him? --- **Brief description** Xiaoming's data generator is the provided file `generator.cpp`. You need to deduce the generator's input from its output.

Input Format

The first line contains an integer $n$. The second line contains $n$ $32$-bit unsigned integers $a_1, a_2, \cdots, a_n$, which are the data generated by Xiaoming.

Output Format

Output only two $32$-bit unsigned integers $\text{seed}$ and $p$ as your answer. You need to ensure that $0 < \text{seed}, p < 2^{32}$. If there are multiple solutions, you may output any one of them.

Explanation/Hint

### Constraints This problem has $50$ test cases, and each test case is worth $2$ points. For all testdata, it is guaranteed that $n = 10^5$, $\text{seed}$ is chosen randomly, and there exists at least one solution. Translated by ChatGPT 5