Need help in one codeforces question

[Problem - B - Codeforces]

what if instead of adjacent elements random two elements are chosen?

like a^b = c
if we know a and c or b and c in advance than we can find the remaining element,by just doing xor of given two values,let say this value is ‘t’

now two cases will be there.
1-if ‘t’ is in the array than it’s simple
2-if ‘t’ is not in the array than how to handle this case??cause there might be a case that xor of other two elements is equal to ‘t’.

P.S. I solved the question with adjacent case but not able to solve this ,it just came in my mind while solving the problem.so if anyone can help in this ,it will be helpful.

Hey @shivamloop :wave: ,
You are right with this randomised approach for case 2 you first have to understand that if the final array have all equal elements as t then your random approach for case 2 will always find a way to make pair (a xor b) = t and this way it will give correct answer but Time complexity will be quadratic.