测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A8132. Hanger

编程题 普及/提高-

题目描述

The first line contains two integers $n$ , $q$ ( $1<=n<=10^{9}$ , $1<=q<=10^{5}$ ), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow $q$ lines with requests, sorted according to time. The request of the type " $0$ $i$ $j$ " ( $1<=i<=j<=n$ ) — is the director's request. The input data has at least one director's request. In all other cases the request contains a positive integer not exceeding $10^{9}$ — an employee identificator. Each odd appearance of the identificator of an employee in the request list is his arrival. Each even one is his leaving. All employees have distinct identificators. When any employee arrives, there is always at least one free hook.

输入格式

For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the $i$ -th one to the $j$ -th one inclusive.

输出格式

无

输入输出样例

输入 #1
9 11
1
2
0 5 8
1
1
3
0 3 8
9
0 6 9
6
0 1 9
输出 #1
2
3
2
5
上一题 去做题 下一题