#P8305. [CoE R4 E] 伪随机

    ID: 6880 远端评测题 1000ms 256MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>洛谷原创Special JudgeO2优化洛谷月赛

[CoE R4 E] 伪随机

Description

A very, very long time ago, Xiaoming generated some data.

His data generator used the following two functions to generate random numbers:

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 srand(seed)\text{srand(seed)}, Xiaoming called rand()\text{rand()} consecutively nn times, and recorded the remainder aia_i obtained by taking the return value of each rand()\text{rand()} modulo pp.

A very, very long time later, only the data generator still remains (see generator.cpp in the provided files), but the parameters seed\text{seed} and pp have been lost.

Xiaoming wants to recover these two parameters from the data. That is, given the sequence aia_i, you need to find any possible values of seed\text{seed} and pp. 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 nn.

The second line contains nn 3232-bit unsigned integers a1,a2,,ana_1, a_2, \cdots, a_n, which are the data generated by Xiaoming.

Output Format

Output only two 3232-bit unsigned integers seed\text{seed} and pp as your answer. You need to ensure that 0<seed,p<2320 < \text{seed}, p < 2^{32}.

If there are multiple solutions, you may output any one of them.

见下发文件的 sample.in
见下发文件的 sample.out

Hint

Constraints

This problem has 5050 test cases, and each test case is worth 22 points.

For all testdata, it is guaranteed that n=105n = 10^5, seed\text{seed} is chosen randomly, and there exists at least one solution.

Translated by ChatGPT 5