CF74D.Hanger

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The first line contains two integers nn , qq ( 1<=n<=1091<=n<=10^{9} , 1<=q<=1051<=q<=10^{5} ), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow qq lines with requests, sorted according to time. The request of the type " 00 ii jj " ( 1<=i<=j<=n1<=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 10910^{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 ii -th one to the jj -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
    
首页