A8132 | Hanger
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted