Equal to X
Time Limit: 1.0 s
Memory Limit: 256.0 MB
Description
You are give 3 integers l,r,x
where (l ≤ r
)and you need to find two integers p and q such that:
- l ≤ p ≤ r
- l ≤ q ≤ r
- p - q = x
If such integers p and q exist, print them. Otherwise, print -1 -1
.
If there are multiple
valid pair(p,q
) exist, you are allowed to print any of them.
Input
- The first line contains an integer t (1 ≤ t ≤ \(10^5\)), the number of test cases.
- For each test case, you are given three integers l, r, and x (1 ≤ l ≤ r ≤ \(10^9\), -\(10^9\) ≤ x ≤ \(10^9\)).
Output
- For each test case, if such pair exist, print p and q separated by a space, otherwise print
-1 -1
.
Sample
Input | Output |
---|---|
|
|
Sample test case explaination:
Second test, We can select p = 15 and q = 12, p - q = 15 - 12 = 3, which is equal to x.
Information
- ID
- 1186
- Difficulty
- 1
- Category
- Math | Brute_Force Click to Show
- Tags
- # Submissions
- 109
- Accepted
- 44
- Accepted Ratio
- 40%
- Uploaded By
Related
In following contests: