There is a rumor that the Scientific Committee is using a special device for encrypting their
communication. If you can crack the encryption you could listen to the problems they have prepared
and score many points. Last night you got lucky: one of the members forgot their device in a bar.
You opened it and looked at the general design:
All the operations use 8 bits. XOR is the bitwise exclusive
or function (the ^
operator in C, xor
operator in Pascal).
, and have secret values only known by the Scientific Committee.- For
let .
Furthermore, we have a function
The device used by the Scientific Committee takes one number at a time, and outputs it encrypted.
After using the device
Even though you understand how the encryption device works, you do not know the secret values
Task
Your task is to find out all the secret values:
Constraints
- A correct solution receives points only if the number of queries is less than
. - In all tests the secret keys
are random.
Interaction
This is an interactive program. To play with the encryption module simply write a number between
SOLUTION
and after that output
Example
Let's assume that
From here we deduce
Contestant output | Contestant input | Comments |
---|---|---|
10 | 11 | M[10 XOR 0] = M[10] = 11 |
10 | 12 | M[10 XOR 1] = M[11] = 12 |
11 | 9 | M[11 XOR 3] = M[8] = 9 |
12 | 14 | M[12 XOR 1] = M[13] = 14 |
... | ... | |
SOLUTION 0 1 3 1 2 3 4 ... 254 255 0 | When you find out the secret values you output them. |
Comments