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.
№ | Пользователь | Рейтинг |
---|---|---|
1 | jiangly | 3976 |
2 | tourist | 3815 |
3 | jqdai0815 | 3682 |
4 | ksun48 | 3614 |
5 | orzdevinwang | 3526 |
6 | ecnerwala | 3514 |
7 | Benq | 3482 |
8 | hos.lyric | 3382 |
9 | gamegame | 3374 |
10 | heuristica | 3357 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 169 |
2 | -is-this-fft- | 162 |
3 | Um_nik | 161 |
4 | atcoder_official | 160 |
5 | djm03178 | 157 |
5 | Dominater069 | 157 |
7 | adamant | 154 |
8 | luogu_official | 152 |
9 | awoo | 151 |
10 | TheScrasse | 148 |
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.
Название |
---|
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.