Gap Query

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

A sequence aa is initially empty. Let nn denote its current length. The following two operations are supported:

  • Append a value to the end of the sequence.
  • Given an index xx, 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 ii (that is, if n=1n=1), the answer is 00.

Input Format

The first line contains one integer mm, the number of operations.

Each of the next mm lines contains two integers opop and xx, describing an operation:

  • If op=1op=1, append the value xx to the end of the sequence.
  • If op=2op=2, query the current sequence using xx as an index. It is guaranteed that 1xn1\leq x\leq n.

Output Format

For each operation with op=2op=2, 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:

  • 1m1051\leq m\leq 10^5;
  • 0ai1050\leq a_i\leq 10^5;
  • for an operation with op=1op=1, 0x1050\leq x\leq 10^5;
  • for an operation with op=2op=2, 1xn1\leq x\leq n.

The appended values and query indices are generated at random within their respective valid ranges.

Hello ACM 2026

未参加
状态
已结束
规则
ACM/ICPC
题目
13
开始于
2026-8-15 13:00
结束于
2026-8-15 18:00
持续时间
5 小时
主持人
参赛人数
31