The Binary Task

Hi everybody! I know one gr8 task but have no idea how to solve it only with binary operations.
The task is:
U’re given the coordinates of three corners of a rectangle(not rotated), u must output the fourth.
E.G. :
5 7
7 5
5 5
7 7
Can anybody help me with this pls?

By “not rotated” you mean that the sides are parallel to the axis?
What do you mean by “binary operation”? Tests?
For example, transpose the coordinates:
5 7 5
5 5 7
You see that 5 is present twice but not 7.
If the case is:
1 2 1
4 4 5
The solution is 2 5.

yeah i know that way with counting. but i need to solve only with binary operations(and,not,or etc.) And yeah, parallel to the axis

The binary operations should be used on what? On the lists?

xor all the xs to get the resulting x. xor all the ys to get the resulting y.

Proving why this work (and when it fails) is left as an exercise to the reader.

The task must be solved using only binary operations. No ifs, no loops, no other good things.

Not gonna always work. But, anyway, thx for the reply

Do you have a single test case where it fails?

Yeah, i do. It’s not said anything about order of coordinates, it can be random

Give one such example, that’s why I asked you :stuck_out_tongue: Until you show me that counterexample I’ll believe the short proof that I have that what I said works.

Well… I can not find it now…Maybe, I’m wrong.:frowning: But why is it going to work?

Use the binary representation of integers and xor them.

Already said that that’s the solution. But the OP said it’s not working because he wants us to also prove that it works, basically he wants us to do his homework -_-

well. It’s not homework… And i’ve proven it yesterday in 5 minutes) Huge thank for the hint)

So you never had a failing example :stuck_out_tongue: