#1687. MEX Queries
MEX Queries
当前没有测试数据。
CF817F
MEX Queries
题面翻译
- 维护一个集合,初始为空。
- 有 种操作:
- 把 中在集合中没有出现过的数添加到集合中。
- 把 中在集合中出现过的数从集合中删掉。
- 把 中在集合中没有出现过的数添加到集合中,并把 中在集合中出现过的数从集合中删掉。
- 每次操作后输出集合的 —— 在集合中没有出现过的最小正整数。
- ,。
题目描述
You are given a set of integer numbers, initially it is empty. You should perform queries.
There are three different types of queries:
- 1 — Add all missing numbers from the interval
- 2 — Remove all present numbers from the interval
- 3 — Invert the interval — add all missing and remove all present numbers from the interval
After each query you should output MEX of the set — the smallest positive (MEX ) integer number which is not presented in the set.
输入格式
The first line contains one integer number ( ).
Next lines contain three integer numbers ( ) — type of the query, left and right bounds.
输出格式
Print MEX of the set after each query.
样例 #1
样例输入 #1
3
1 3 4
3 1 6
2 1 3
样例输出 #1
1
3
1
样例 #2
样例输入 #2
4
1 1 3
3 5 6
2 4 4
3 1 6
样例输出 #2
4
4
4
1
提示
Here are contents of the set after each query in the first example:
- — the interval is added
- — numbers from the interval got deleted and all the others are added
- — numbers got deleted