【map】【multiset】hdu 4022
来源:互联网 发布:苹果mac快捷键大全 编辑:程序博客网 时间:2024/04/28 00:39
1. 可能有重复点(这一点题目并没有说明),因此 set 行不通
2. 用 C++ 的 cin, cout 超时
/* * hdu 4022 * http://acm.hdu.edu.cn/showproblem.php?pid=4022 * 1500MS12376K * 【map】【multiset】 * 1. 可能有重复点(这一点题目并没有说明),因此 set 行不通 * 2. 用 C++ 的 cin, cout 超时 */#include <cstdio>#include <map>#include <set>using namespace std;typedef map<int, multiset<int> > BaseMap;void BombLine(BaseMap &oBMTarget, int iLine, BaseMap &oBM2){ for (multiset<int>::iterator it = oBMTarget[iLine].begin(); it != oBMTarget[iLine].end(); ++it ) { oBM2[*it].erase(iLine); } oBMTarget[iLine].clear();}int main(){ int iBaseNum, iBomberNum, x, y, c, d; while (1) { scanf("%d%d", &iBaseNum, &iBomberNum); if ( (0 == iBaseNum) && (0 == iBomberNum) ) { break; } BaseMap oBMh, oBMv; while (iBaseNum--) { scanf("%d%d", &x, &y); oBMh[x].insert(y); oBMv[y].insert(x); } while (iBomberNum--) { scanf("%d%d", &c, &d); if (0 == c) { printf("%d\n", oBMh[d].size()); BombLine(oBMh, d, oBMv); } else { printf("%d\n", oBMv[d].size()); BombLine(oBMv, d, oBMh); } } printf("\n"); } return 0;}
0 0
- 【map】【multiset】hdu 4022
- HDU 4022 Boming (Map , multiset)
- HDU 4022 Bombing (map + multiset)
- hdu 4022 multiset
- HDU Bombing (STL multiset+map)
- set与multiset HDU 4022Bombing
- map,multimap,set,multiset
- HDU1897-multiset+map
- hdu4022 map+multiset
- set,map,multiset,multimap
- map,multimap,set,multiset
- map/multimap/set/multiset
- MultiSet(借用map实现multiset的功能)
- HDU 2275 multiset
- hdu 4302 STL multiset
- hdu 5875 Function(multiset)
- hdu 2275 multiset
- hdu 6180 贪心+multiset
- 10大最适合编程的字体推荐下载,让代码看起来更美更舒服!
- 李建忠:Metadata是.NET平台的核心灵魂
- 通用管理系统概要设计说明书
- Ganymed SSH-2 for Java系列2之连接远程服务器
- Python 内建函数,filter,map, reduce
- 【map】【multiset】hdu 4022
- 62 Java 重写类的equals()方法
- 类的概述
- 新浪微博正式在美国上市
- 下载和编译duilib (vs2010)
- 微软ASP.NET技术“乱谈”
- Cocos2d-x旧引擎目录结构
- opencv学习-建立人脸识别分类器
- POJ 2001 Shortest Prefixes