#P8918. 『MdOI R5』Jump
『MdOI R5』Jump
Problem Description
There is a person on a number line. Let their position be , and initially . In the -th second, they can choose to jump left or right by units, that is, increase or decrease by . Find the minimum number of seconds needed to reach , meaning that at the end of some second, . If it is impossible to ever reach , output .
In this problem, each test point contains multiple test cases.
Input Format
The first line contains an integer , the number of test cases.
The next lines each contain an integer, representing in one test case.
Output Format
Output lines. Each line contains one number, in order, representing the answer for each test case.
10
1
2
7
8
9
10
11
935
101
2023
1
-1
3
-1
4
-1
4
10
7
11
Hint
For of the data, , .
: .
: , where is a non-negative integer.
: No special constraints.
Sample Explanation 1
When , it is enough to jump to the right in the first second.
When , it can be proven that it is impossible to ever reach .
Translated by ChatGPT 5