Missing Number Queries
시간 제한2초메모리 제한256 MB
배열에서 한 원소를 갱신하는 연산과 구간이 주어질 때, 그 구간에 나타나지 않는 [1, N] 범위의 값을 아무거나 하나 찾아 출력한다.
문제
Busy Beaver has an array of positive integers , consisting of positive integers at most . He needs to perform operations on the array of two types:
1: Set .2: Output any integer in the range that is not found in .
Help answer all of Busy Beaver's queries! The input will be generated in such a way that an answer exists for all type 2 queries.
입력
The first line contains two positive integers and (; ).
The second line contains integers ().
Each of the next lines contains three positive integers: either 1 or 2 (; ).
Additional constraint on the input: there is at least one type 2 query, and every type 2 query has an answer.
출력
For each type 2 query, output a single line containing the answer. If there are multiple possible answers for a query, you may output any of them.
힌트
In the first query, the only integer from to missing from is , so is the only possible answer.
After the second query, the array becomes .
After the third query, the array becomes .
The last query asks for an integer from to missing from . Either or would be acceptable answers to this query.