MEXor Mixup codeforces solution
Alice gave Bob two integers non-negative integers with value of all elements equal to and value of all elements equal to .and ( and ). Being a curious boy, Bob wrote down an array of
What is the shortest possible length of the array Bob wrote?
The input consists of multiple test cases. The first line contains an integer( ) — the number of test cases. The description of the test cases follows.
The only line of each test case contains two integersand ( ; ) — the and of the array, respectively.
Output MEXor Mixup codeforces solution
For each test case, output one (positive) integer — the length of the shortest array withand . We can show that such an array always exists.
Example MEXor Mixup codeforces solution
input MEXor Mixup codeforces solution
Copy MEXor Mixup codeforces solution
5 1 1 2 1 2 0 1 10000 2 10000
In the first test case, one of the shortest arrays withand is .
In the second test case, one of the shortest arrays withand is .
It can be shown that these arrays are the shortest arrays possible.