#P9373. 「DROI」Round 2 构造与取模
「DROI」Round 2 构造与取模
Background
Instead of writing a weak background, it is better to create a higher-quality problem.
Problem Description
For integers , if there exist a non-negative integer and a positive integer such that:
then we call the ordered pair an excellent split of (where means and).
Now given non-negative integers , please construct any excellent split of , and output the and in your construction. In particular, if no such split exists, output -1.
Input Format
This problem has multiple test cases.
The first line contains a positive integer , representing the number of test cases.
The next lines each contain two non-negative integers, .
Output Format
Output a total of lines. The -th line gives the answer for the -th test case.
3
1 0
13 3
198818800000 122122200000
0 1
8 5
-1
Hint
Sample Explanation
For the first test case, there is only one possible construction.
For the second test case, is also a valid construction.
For the third test case, it can be proved that no valid construction exists.
Constraints
"This problem uses bundled tests."
-
: .
-
: .
-
: no special restrictions.
For of the testdata: , .
Translated by ChatGPT 5