#P6720. [BalkanOI 2011] decrypt
[BalkanOI 2011] decrypt
Description
We randomly choose three numbers , and generate the whole sequence by the following rule:
Here, denotes the XOR operation.
In addition, we have a function , which is a bijection. That is, we guarantee that for , .
Your goal is to determine after making multiple queries.
Interaction
Your program should read from standard input and write to standard output.
You may output an integer to standard output. If this is your -th query, you will read:
If you have obtained all answers, output a line with the string SOLUTION, and then output lines, which are .
Remember to flush the output buffer after printing each line.
Output Format
Hint
Sample
(Because the sample testdata is hard to present, it is placed here.)
We manually set $R_0 = 0, R_1 = 1, R_2 = 3, M(i) = (i + 1) \bmod 256$.
Then .
| Output | Input | Explanation |
|---|---|---|
| … | Some outputs are omitted. | |
SOLUTION |
Constraints and limits
For of the testdata, it is guaranteed that the input numbers, output numbers, the array , and both and in are all and .
Scoring policy
If the number you output is not within the range above, you will fail.
Your number of queries must be less than , otherwise, you will fail.
Hint
Sample
(Because the sample testdata is hard to present, it is placed here.)
We manually set $R_0 = 0, R_1 = 1, R_2 = 3, M(i) = (i + 1) \bmod 256$.
Then .
| Output | Input | Explanation |
|---|---|---|
| … | Some outputs are omitted. | |
SOLUTION |
Constraints and limits
For of the testdata, it is guaranteed that the input numbers, output numbers, the array , and both and in are all and .
Scoring policy
If the number you output is not within the range above, you will fail.
Your number of queries must be less than , otherwise, you will fail.
Hint
How to flush the output buffer:
C:
printf("%d\n", q);
fflush(stdout);
C++:
cout<<q<< '\n';
cout.flush();
Pascal:
writeln(q);
flush(output);
Note
This problem is translated from Balkan Olympiad in Informatics 2011 Day 1 T2 decrypt.
Thanks to
Translated by ChatGPT 5
京公网安备 11011102002149号