Let's suppose you have an array A of numbers (0-255). Then, you pick a single variable K (0-255), and you create another array B. Where Bi = Ai ^ K. Is there a way to restore the original array A? If you are not giving A or K.
# | User | Rating |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
Let's suppose you have an array A of numbers (0-255). Then, you pick a single variable K (0-255), and you create another array B. Where Bi = Ai ^ K. Is there a way to restore the original array A? If you are not giving A or K.
Name |
---|
Anyone cares to share the solution if it's so obvious that I'm getting downvotes?
You need to be orange or red to get pluses on this website...
https://www.youtube.com/watch?v=rxPpkdSIOPE
255255 has 614 digits.
Are you sure about constraints or is there any modulo involved ?
It is not a POWER it is XOR
Thanks for pointing that out. It can confuse some people.
if (Ai^K = Bi) then
Ai^K^K = Bi^K, so Ai = Bi^K(because K^K = 0)
Ai^K^Ai = Bi^Ai, so K = Bi^Ai(because Ai^Ai = 0)
That's how we can find Ai, when we have Bi and K or we can find K, when we have Ai and Bi.