MEXor Mixup solution codeforces
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.
For each test case, output one (positive) integer — the length of the shortest array withand . We can show that such an array always exists.
input MEXor Mixup solution codeforces
5 1 1 2 1 2 0 1 10000 2 10000
3 2 3 2 3
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.
Also read : Airline Restrictions codechef solution