1325D.md (1101B)
1 Source: https://codeforces.com/problemset/problem/1325/D 2 3 D. Ehab the Xorcist 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Given 2 integers $u$ and $v$, find the shortest array such that [bitwise-xor](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of its elements is $u$, and the sum of its elements is $v$. 22 23 Input 24 25 The only line contains 2 integers $u$ and $v$ $(0 \le u,v \le 10^{18})$. 26 27 Output 28 29 If there's no array that satisfies the condition, print "-1". Otherwise: 30 31 The first line should contain one integer, $n$, representing the length of the desired array. The next line should contain $n$ positive integers, the array itself. If there are multiple possible answers, print any. 32 33 Examples 34 35 Input 36 37 ``` 38 2 4 39 ``` 40 41 Output 42 43 ``` 44 2 45 3 1 46 ``` 47 48 Input 49 50 ``` 51 1 3 52 ``` 53 54 Output 55 56 ``` 57 3 58 1 1 1 59 ``` 60 61 Input 62 63 ``` 64 8 5 65 ``` 66 67 Output 68 69 ``` 70 -1 71 ``` 72 73 Input 74 75 ``` 76 0 0 77 ``` 78 79 Output 80 81 ``` 82 0 83 ``` 84 85 Note 86 87 In the first sample, $3\oplus 1 = 2$ and $3 + 1 = 4$. There is no valid array of smaller length. 88 89 Notice that in the fourth sample the array is empty.