#abc347d. D - Popcount and XOR
D - Popcount and XOR
Score: points
问题陈述
给定非负整数 、 和 。确定是否存在一对非负整数 满足以下五个条件。如果存在这样的一对,打印出来。
这里, 表示按位异或。
如果多个一对 满足条件,你可以打印出其中任意一个。
什么是popcount?
对于非负整数 , 的popcount是其二进制表示中1的个数。更精确地说,对于非负整数 ,使得 $\displaystyle x=\sum _ {i=0} ^ \infty b _ i2 ^ i\ (b _ i\in\lbrace0,1\rbrace)$,我们有 $\displaystyle\operatorname{popcount}(x)=\sum _ {i=0} ^ \infty b _ i$。
例如,二进制表示中 是 1101
,所以 。什么是按位异或?
对于非负整数 ,按位异或 定义如下。
- 二进制表示中 的 的位置 如果 和 的二进制表示中 的位置 只有一个是1,则为1,否则为0。
例如,二进制表示中 和 分别是 1001
和 0011
,所以 (二进制表示为 1010
)。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given non-negative integers , , and . Determine if there is a pair of non-negative integers that satisfies all of the following five conditions. If such a pair exists, print one.
Here, denotes the bitwise XOR.
If multiple pairs satisfy the conditions, you may print any of them.
What is popcount?
For a non-negative integer , the popcount of is the number of s in the binary representation of . More precisely, for a non-negative integer such that $\displaystyle x=\sum _ {i=0} ^ \infty b _ i2 ^ i\ (b _ i\in\lbrace0,1\rbrace)$, we have $\displaystyle\operatorname{popcount}(x)=\sum _ {i=0} ^ \infty b _ i$.
For example, in binary is 1101
, so . What is bitwise XOR?
For non-negative integers , the bitwise exclusive OR is defined as follows.
- The 's place in the binary representation of is if exactly one of the 's places in the binary representations of and is , and otherwise.
For example, and in binary are 1001
and 0011
, respectively, so (in binary, 1010
).
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
If there is a pair of non-negative integers that satisfies the conditions, choose one such pair and print and in this order, with a space in between. If no such pair exists, print -1
.
Sample Input 1
3 4 7
Sample Output 1
28 27
The pair satisfies the conditions. Here, and in binary are 11100
and 11011
, respectively.
- in binary is
11100
, so . - in binary is
11011
, so . - in binary is
00111
, so .
If multiple pairs of non-negative integers satisfy the conditions, you may print any of them, so printing 42 45
, for example, would also be accepted.
Sample Input 2
34 56 998244353
Sample Output 2
-1
No pair of non-negative integers satisfies the conditions.
Sample Input 3
39 47 530423800524412070
Sample Output 3
540431255696862041 10008854347644927
Note that the values to be printed may not fit in -bit integers.