#P8305. [CoE R4 E] 伪随机
[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 , Xiaoming called consecutively times, and recorded the remainder obtained by taking the return value of each modulo .
A very, very long time later, only the data generator still remains (see generator.cpp in the provided files), but the parameters and have been lost.
Xiaoming wants to recover these two parameters from the data. That is, given the sequence , you need to find any possible values of and . 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 .
The second line contains -bit unsigned integers , which are the data generated by Xiaoming.
Output Format
Output only two -bit unsigned integers and as your answer. You need to ensure that .
If there are multiple solutions, you may output any one of them.
见下发文件的 sample.in
见下发文件的 sample.out
Hint
Constraints
This problem has test cases, and each test case is worth points.
For all testdata, it is guaranteed that , is chosen randomly, and there exists at least one solution.
Translated by ChatGPT 5
京公网安备 11011102002149号