#P7121. Ame 和 Gura 的奇妙探险
Ame 和 Gura 的奇妙探险
Description
Ame knows that as long as she can find the seed used to initialize the MT19937 engine, she can figure out how to obtain a Silk Touch pickaxe. So she traveled around the world, and with her clever detective mind, she worked out the first random numbers generated right after the MT19937 engine was initialized (note: here is a parameter in the MT19937 engine). Now she gives you these random numbers, hoping that you can deduce the seed used to initialize the MT19937 engine (). Note that Mivicraft does not use the standard MT19937 engine: some parameters are changed compared with the paper, and Ame has appended them to the input. Please help Ame!
Kind Mivik has prepared a simple and easy-to-understand MT19937 implementation for you. Please check it in the attachment.
Input Format
The first line contains 10 non-negative integers, corresponding to the 10 parameters in MT19937: , , , , , , , , , and .
The next lines each contain one non-negative integer, representing in order the random numbers generated right after the MT19937 engine was initialized.
Output Format
Output one non-negative integer in a single line, representing the seed used when initializing the MT19937 engine. The testdata guarantees that there is a solution. If there are multiple solutions, you only need to output any one of them.
见 sample/1.in
见 sample/1.out
见 sample/2.in
见 sample/2.out
Hint
Sample Explanation #1
All 10 parameters use the standard MT19937 parameters, and the seed is 233333. That is, you can generate the same random number sequence with the following program:
#include <iostream>
#include <random>
std::mt19937 engine(233333);
int main() {
for (int i = 0; i < 624; ++i)
std::cout << engine() << std::endl;
return 0;
}
Constraints
This problem uses bundled tests.
For all data, , , , , and is guaranteed to be odd.
The specific limits for each subtask are shown in the table below:
| Subtask ID | Points | Special Constraints |
|---|---|---|
| 1 | 20 | The seed is less than or equal to |
| 2 | 30 | , |
| 3 | 50 | None |
Note: The provided files are encoded in UTF-8. Please use an editor that can recognize this encoding to open them.
Backup link for attachment download: Baidu Netdisk Extraction code: jf9e
Translated by ChatGPT 5
京公网安备 11011102002149号