시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB (추가 메모리 없음)2641016239.744%

문제

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 $a_1,a_2,\dots ,a_k$ of positive length $k$, satisfying $a_{i+1}=a_i+1$ for all $1\leq i\leq k-1$.

The game begins with an empty set and consists of $Q$ 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, $Q$.

The following $Q$ lines contain two integers, describing Takina’s move. Each line has one of the following forms:

  • 1 $x$ : Insert $x$ into the set. It is guaranteed that $x$ was not in the set.
  • 2 $x$ : Delete $x$ from the set. It is guaranteed that $x$ was in the set.

출력

Output $Q$ integers separated by newlines, the number of continuous increasing sequences in the set after each Takina’s move.

제한

  • $1\leq Q\leq 300\, 000$
  • $1\leq x\leq 10^9$

예제 입력 1

3
1 1
1 2
2 1

예제 출력 1

1
3
1

출처

University > KAIST > 2022 KAIST 12th ICPC Mock Competition H번