codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1790E.md (1264B)


      1 Source: https://codeforces.com/problemset/problem/1790/E
      2 
      3 E. Vlad and a Pair of Numbers
      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 Vlad found two positive numbers $a$ and $b$ ($a,b \gt 0$). He discovered that $a \oplus b = \frac{a + b}{2}$, where $\oplus$ means the [bitwise exclusive OR](http://tiny.cc/xor_wiki_eng) , and division is performed without rounding..
     22 
     23 Since it is easier to remember one number than two, Vlad remembered only $a\oplus b$, let's denote this number as $x$. Help him find any suitable $a$ and $b$ or tell him that they do not exist.
     24 
     25 Input
     26 
     27 The first line of the input data contains the single integer $t$ ($1 \le t \le 10^4$) — the number of test cases in the test.
     28 
     29 Each test case is described by a single integer $x$ ($1 \le x \le 2^{29}$) — the number that Vlad remembered.
     30 
     31 Output
     32 
     33 Output $t$ lines, each of which is the answer to the corresponding test case. As the answer, output $a$ and $b$ ($0 \lt a,b \le 2^{32}$), such that $x = a \oplus b = \frac{a + b}{2}$. If there are several answers, output any of them. If there are no matching pairs, output -1.
     34 
     35 Example
     36 
     37 Input
     38 
     39 ```
     40 6
     41 
     42 2
     43 
     44 5
     45 
     46 10
     47 
     48 6
     49 
     50 18
     51 
     52 36
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 3 1
     59 -1
     60 13 7
     61 -1
     62 25 11
     63 50 22
     64 ```