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 | 4009 |
2 | jiangly | 3821 |
3 | Benq | 3736 |
4 | Radewoosh | 3631 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3388 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
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.