×

计蒜客

  1. 题库
  2. so easy
  3. 问答
  • 18.42%
  • 262144K

There are $n$ points in an array with index from $1$ to $n$, and there are two operations to those points.

1: $1 \ x$ marking the point $x$ is not available

2: $2 \ x$ query for the index of the first available point after that point (including $x$ itself) .


Input

$n\quad q$

$z_1 \quad x_1$

$\vdots$

$z_q\quad x_q$

$q$ is the number of queries, $z$ is the type of operations, and $x$ is the index of operations. $1≤x<n<10^9$, $1 \leq q<10^6 $ and $z$ is $1$ or $2$

Output

Output the answer for each query.

样例输入

5 3
1 2
2 2
2 1

样例输出

3
1

想挑战这道题吗

  • main.c