{"problem":{"name":"D. Plus and xor","description":{"content":"Bitwise exclusive OR (or bitwise addition modulo two) is a binary operation which is equivalent to applying logical exclusive OR to every pair of bits located on the same positions in binary notation ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF76D"},"statements":[{"statement_type":"Markdown","content":"Bitwise exclusive OR (or bitwise addition modulo two) is a binary operation which is equivalent to applying logical exclusive OR to every pair of bits located on the same positions in binary notation of operands. In other words, a binary digit of the result is equal to 1 if and only if bits on the respective positions in the operands are different.\n\nFor example, if _X_ = 10910 = 11011012, _Y_ = 4110 = 1010012, then:\n\n<center>_X_ _xor_ _Y_  =  6810  =  10001002.</center>Write a program, which takes two non-negative integers _A_ and _B_ as an input and finds two non-negative integers _X_ and _Y_, which satisfy the following conditions:\n\n*   _A_ = _X_ + _Y_\n*   _B_  =  _X_ _xor_ _Y_, where _xor_ is bitwise exclusive or.\n*   _X_ is the smallest number among all numbers for which the first two conditions are true.\n\n## Input\n\nThe first line contains integer number _A_ and the second line contains integer number _B_ (0 ≤ _A_, _B_ ≤ 264 - 1).\n\n## Output\n\nThe only output line should contain two integer non-negative numbers _X_ and _Y_. Print the only number _\\-1_ if there is no answer.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"按位异或（或按位模二加法）是一种二元运算，它等价于对操作数二进制表示中相同位置的每一位应用逻辑异或。换句话说，结果的二进制位等于 1，当且仅当操作数中对应位置的位不同。\n\n例如，若 #cf_span[X = 10910 = 11011012], #cf_span[Y = 4110 = 1010012]，则：\n\n编写一个程序，输入两个非负整数 #cf_span[A] 和 #cf_span[B]，找出两个非负整数 #cf_span[X] 和 #cf_span[Y]，满足以下条件：\n\n第一行包含整数 #cf_span[A]，第二行包含整数 #cf_span[B]（#cf_span[0 ≤ A, B ≤ 264 - 1]）。\n\n输出仅一行，包含两个非负整数 #cf_span[X] 和 #cf_span[Y]。若无解，请仅输出 _-1_。\n\n## Input\n\n第一行包含整数 #cf_span[A]，第二行包含整数 #cf_span[B]（#cf_span[0 ≤ A, B ≤ 264 - 1]）。\n\n## Output\n\n输出仅一行，包含两个非负整数 #cf_span[X] 和 #cf_span[Y]。若无解，请仅输出 _-1_。\n\n[samples]","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ A, B \\in \\mathbb{Z}_{\\geq 0} $ with $ 0 \\leq A, B \\leq 2^{64} - 1 $.  \nWe seek $ X, Y \\in \\mathbb{Z}_{\\geq 0} $ such that:  \n$$\nX + Y = A \\quad \\text{and} \\quad X \\oplus Y = B\n$$\nwhere $ \\oplus $ denotes bitwise XOR.\n\n**Constraints**  \n1. $ 0 \\leq A, B \\leq 2^{64} - 1 $  \n2. $ X, Y \\geq 0 $\n\n**Objective**  \nFind $ X, Y \\in \\mathbb{Z}_{\\geq 0} $ satisfying:  \n$$\nX + Y = A \\quad \\text{and} \\quad X \\oplus Y = B\n$$  \nIf no such pair exists, output $-1$.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF76D","tags":["dp","greedy","math"],"sample_group":[["142\n76","33 109"]],"created_at":"2026-03-03 11:00:39"}}