#abc330e. E - Mex and Update
E - Mex and Update
Score : points
问题描述
你已获得一个长度为 的序列 。
按照给定顺序,依次回答以下 个查询请求。
第 个查询采用如下格式给出:
$i_k$ $x_k$
- 首先,将 改变为 。这一改变将会对后续的查询产生影响。
- 然后,输出 的 值。
- 的 值是指在 中不存在的最小非负整数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a sequence of length .
Respond to the following queries in the order they are given.
The -th query is given in the following format:
$i_k$ $x_k$
- First, change to . This change will carry over to subsequent queries.
- Then, print the of .
- The of is the smallest non-negative integer not contained in .
Constraints
- All input values are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines in total.
The -th line should contain the answer to the -th query as an integer.
Sample Input 1
8 5
2 0 2 2 1 1 2 5
4 3
4 4
6 3
8 1000000000
2 1
Sample Output 1
4
3
6
5
0
Initially, the sequence is .
This input gives you five queries.
- The first query changes to , making .
- At this point, the of is .
- The second query changes to , making .
- At this point, the of is .
- The third query changes to , making .
- At this point, the of is .
- The fourth query changes to , making .
- At this point, the of is .
- The fifth query changes to , making .
- At this point, the of is .
update @ 2024/3/10 01:14:12