Set and Sequence and Query
시간 제한2초메모리 제한1024 MB
1e9 범위의 정수 집합에 삽입과 삭제가 Q번 일어날 때, 매번 연속한 값들의 구간이 집합에 몇 개 있는지를 출력한다.
문제
Takina and Chisato are playing a game with a set of positive integers.
This game is about making continuous increasing sequences using the numbers from the set.
A continuous increasing sequence is defined as a sequence of positive length , satisfying for all .
The game begins with an empty set and consists of turns. In each turn, Takina can either insert a new integer into the set or delete an integer from the set.
Every time a change is made to the set, Chisato has to count how many different continuous increasing sequences can be made using the numbers from the set.
Your task is to help Chisato.
입력
The first line contains the number of turns, .
The following lines contain two integers, describing Takina’s move. Each line has one of the following forms:
1: Insert into the set. It is guaranteed that was not in the set.2: Delete from the set. It is guaranteed that was in the set.
출력
Output integers separated by newlines, the number of continuous increasing sequences in the set after each Takina’s move.