| Codeforces Round 1077 (Div. 1) |
|---|
| Finished |
You are given two non-negative integers $$$x$$$, $$$y$$$. Find two non-negative integers $$$p$$$ and $$$q$$$ such that $$$p\;\&\;q=0$$$, and $$$|x-p|+|y-q|$$$ is minimized. Here, $$$\&$$$ denotes the bitwise AND operation.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.
The only line of each test case contains two non-negative integers $$$x$$$ and $$$y$$$ ($$$0 \le x,y \lt 2^{30}$$$).
For each test case, output two non-negative integers $$$p$$$ and $$$q$$$ you found. If there are multiple pairs of $$$p$$$ and $$$q$$$ satisfying the conditions, you may output any of them.
It can be proven that under the constraints of the problem, any valid solution satisfies $$$\max(p,q) \lt 2^{31}$$$.
70 01 13 67 114 4123 3211073741823 1073741822
0 02 13 86 94 3128 3211073741824 1073741822
In the first test case, one valid pair would be $$$p=0$$$ and $$$q=0$$$, as $$$0\,\&\,0=0$$$ and $$$|x-p|+|y-q|=|0-0|+|0-0|=0$$$ is the minimum over all pairs of $$$p$$$ and $$$q$$$.
In the third test case, one valid pair would be $$$p=3$$$ and $$$q=8$$$, as $$$3\,\&\,8=0$$$ and $$$|x-p|+|y-q|=|3-3|+|8-6|=2$$$ is the minimum over all pairs of $$$p$$$ and $$$q$$$. Note that $$$(p,q)=(3,4)$$$ is also a valid pair.
| Name |
|---|


