HDU 4022 STL
来源:互联网 发布:移动定制机网络解锁 编辑:程序博客网 时间:2024/06/05 07:43
// 使用map<int,multiset<int> > 实现一对多,因为会有重点,所以用multimap
#include<iostream>
#include<cstdio>#include<map>
#include<set>
using namespace std;
map<int,multiset<int> > cnt_x,cnt_y;
int main(){
int n,m;
while(scanf("%d%d",&n,&m),n+m){
cnt_x.clear();
cnt_y.clear();
for(int i=0;i<n;i++){
int x,y;
scanf("%d%d",&x,&y);
cnt_x[x].insert(y);
cnt_y[y].insert(x);
}
for(int i=0;i<m;i++){
int c,d;
scanf("%d%d",&c,&d);
multiset<int>::iterator it;
if(c){
printf("%d\n",cnt_y[d].size());
for(it=cnt_y[d].begin();it!=cnt_y[d].end();it++){
cnt_x[*it].erase(d);
}
cnt_y[d].clear();
}
else{
printf("%d\n",cnt_x[d].size());
for(it=cnt_x[d].begin();it!=cnt_x[d].end();it++){
cnt_y[*it].erase(d);
}
cnt_x[d].clear();
}
}
puts("");
}
}
- HDU 4022 STL
- HDU 4022 Bombing (STL)
- 【STL】hdu 4022 Bombing
- HDU 4022 Bombing STL/二分
- HDU 4022 Bombing STL 模拟题
- HDU 1269 STL 自娱自乐
- 【水STL】hdu 4039
- hdu++1800++STL
- HDU 4585 Shaolin (STL)
- hdu 1027 STL
- STL容器-----HDU 水果
- hdu 1027 STL next_permutation
- hdu 4302 STL multiset
- HDU 3172 (STL map)
- HDU 2094 STL
- hdu 4989 Summary(STL)
- HDU 1702 STL
- HDU 1027 STL
- VMware9虚拟机安装MAC OS X Mountain Lion 10.8.2详细图文教程
- LeetCode 3: Longest Substring Without Repeating Characters
- 安装oracle编辑.bash_profile
- C++内存管理
- iOS开发之自定义加载等待框(MBProgressHUD)
- HDU 4022 STL
- ubuntu server 12.04下git、github
- 《算法竞赛-训练指南》第二章-2.27_LA 5009
- 构建动态链表
- 图解CSS的padding,margin,border属性(详细介绍及举例说明)
- Linux下多任务间通信和同步-概述
- 继承中虚函数表占的空间
- 求数组最K大值下标
- android开发心得(一)