#H2026G. Gap Query
Gap Query
Description
A sequence is initially empty. Let denote its current length. The following two operations are supported:
- Append a value to the end of the sequence.
- Given an index , find$$\max_{1 \leq i \leq n,\ i \neq x}\left\lfloor\frac{a_i}{|x-i|}\right\rfloor. $$
If there is no valid index (that is, if ), the answer is .
Input Format
The first line contains one integer , the number of operations.
Each of the next lines contains two integers and , describing an operation:
- If , append the value to the end of the sequence.
- If , query the current sequence using as an index. It is guaranteed that .
Output Format
For each operation with , output the answer on a separate line.
Sample
Input #1
3
1 1
1 2
2 1
Output #1
2
Constraints
For all test cases:
- ;
- ;
- for an operation with , ;
- for an operation with , .
The appended values and query indices are generated at random within their respective valid ranges.
相关
在下列比赛中: