ACM_STL
cowboy90
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #207 (Div. 2) C. Knight Tournament (STL中的set处理)
http://codeforces.com/contest/357/problem/C 题意: 第一行输入n,m,n表示有n个人(标号1~n),m表示有m 场战斗,接下来m行,每行输入l , r , x ,表示标号从l 到 r的人进行了一场战斗,其中x (l Sample test(s) input 4 3 1 2 1 1 3 3 1 4 4 out转载 2013-10-22 22:48:52 · 628 阅读 · 0 评论 -
hdoj1896 Stones (priority_queue)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1896 Sample Input 2 2 1 5 2 4 2 1 5 6 6 Sample Output 11 12 题意: 有T个case,n个石头,每个石头有一对性质(a,b),a石头现在的位置,b为石头可以从当前位置被抛出的距离,当小伙伴遇到第原创 2013-11-01 00:51:04 · 615 阅读 · 0 评论 -
poj2643 Election (map)
题目:http://poj.org/problem?id=2643 Output Output consists of a single line containing one of: The name of the party with whom the winning candidate is associated, if there is a winning candid原创 2013-11-02 08:32:29 · 529 阅读 · 0 评论 -
hdoj4268 Alice and Bob (multiset +贪心)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4268 题意:女生和男生各有n张牌,牌的高和宽分别为h,w,当女生的牌的高和宽分别大于等于男生的高和宽时表示女生的牌可以覆盖男生的牌,问女生最多可以覆盖多少张男生的牌,进行了覆盖组合的两张牌不可重复使用。 思路: 先用两个结构体分别存女生和男生的数据,先h再w 都从小到大排序,然后贪心,从小到大枚举女原创 2013-11-05 10:46:39 · 767 阅读 · 0 评论 -
hdoj1022 Train Problem I ( stack )
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1022 Train Problem I Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get原创 2013-11-05 12:48:47 · 622 阅读 · 0 评论 -
hdoj4699 (stack)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4699 Sample Input 8 I 2 I -1 I 1 Q 3 L D R Q 2 Sample Output 2 3 Hint The following diagram shows the status of sequence after each转载 2013-11-07 12:31:14 · 488 阅读 · 0 评论 -
hdoj1160 FatMouse's Speed ( STL + 最长下降子序列 /DP)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1160 FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submissi原创 2013-11-27 19:13:36 · 552 阅读 · 0 评论 -
hdoj1058 Humble Numbers ( set 水)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1058 Humble Numbers Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5,原创 2013-12-02 18:52:05 · 539 阅读 · 0 评论 -
set和multiset使用方法 (STL)
set容器是关联式容器,它封装的数据结构是二叉树,而且是一种高效的平衡二叉树——红黑树,它的统计性能高于一般的平衡二叉树。声明的每个set容器中只能存放一种数据类型的数据,而且值不会重复出现,容器会自动升序排列存放数据,容器中的数据元素不能直接 被修改。 #include #include #include using namespace std; int main() { settes原创 2017-06-17 14:42:49 · 357 阅读 · 0 评论 -
poj 2503 Babelfish (map / 二分)
题目:http://poj.org/problem?id=2503 Sample Input dog ogday cat atcay pig igpay froot ootfray loops oopslay atcay ittenkay oopslay Sample Output cat eh loops 题意: 字典里每行两个单词,第一个为解释,第二个为原词,两词之间用空格原创 2013-11-01 07:47:53 · 539 阅读 · 0 评论 -
hdoj1509 Windows Message Queue (优先队列)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1509 Sample Input GET PUT msg1 10 5 PUT msg2 10 4 GET GET GET Sample Output EMPTY QUEUE! msg2 10 msg1 10 EMPTY QUEUE! 题意: 数据库转载 2013-11-01 00:42:49 · 547 阅读 · 0 评论 -
hdoj2072 单词数 (set 和 map 两种做法)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=2072 单词数 Problem Description lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。 Input 有多组数据,每组一行,每组就是一原创 2013-10-29 18:44:05 · 581 阅读 · 0 评论 -
hnuoj LRU Caching (链表,结构体指针 / vector)
http://acm.hnu.cn/online/?action=problem&type=show&id=12763 LRU Caching Time Limit: 3000ms, Special Time Limit:7500ms, Memory Limit:65536KB Total submit users: 37, Accepted users:原创 2013-10-27 16:59:47 · 799 阅读 · 0 评论 -
vector
STL--vector(2) 一、容器的分类 容器有序列式容器(Sequence containers)和关联式容器(Associated containers) 序列式容器:每个元素的位置取决于元素被插入的时机,被插入时设置的位置,和元素值本身无关。 序列式容器有vector、deque、list 关联式容器:元素位置取决于特定的排序准则,和插入顺序无关。 关联式容器有set转载 2013-10-30 07:38:27 · 600 阅读 · 0 评论 -
hdoj1412 {A} + {B} (set)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1412 {A} + {B} Problem Description 给你两个集合,要求{A} + {B}. 注:同一个集合中不会有两个相同的元素. Input 每组输入数据分为三行,第一行有两个数字n,m(0 Output 针对每组数据原创 2013-10-29 19:05:50 · 477 阅读 · 0 评论 -
hdoj1263 水果 ( 二维map )
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1263 水果 Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了.原创 2013-10-29 17:09:41 · 676 阅读 · 0 评论 -
hdoj4585 Shaolin (set+map)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4585 Shaolin Problem Description Shaolin temple is very famous for its Kongfu monks.A lot of young men go to Shaolin temple every year, trying t原创 2013-10-30 00:53:01 · 650 阅读 · 0 评论 -
hdoj1897 SnowWolf's Wine Shop (multiset)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1897 SnowWolf's Wine Shop Problem Description After retired from hustacm, Sempr(Liangjing Wang) find a part-time-job in Snowwolf(Wei Xu)'s win原创 2013-10-30 09:01:54 · 902 阅读 · 0 评论 -
hdoj4022 Bombing (map+multiset && 二分)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4022 题意:有n个基地 ,m个炸弹,每个基地都有一个坐标(x,y) ,每个炸弹有一个性质(c,d),当c=0时炸弹可以炸掉x=d的一行,当c=1时炸弹可以炸掉y=d的一行。 问每个炸弹炸掉了多少个基地,被炸掉后的基地不重复计数。 #include #include #include #inclu原创 2013-10-30 19:54:54 · 629 阅读 · 0 评论 -
map使用方法 (STL)
1. map是一类关联式容器。它的特点是增加和删除节点对迭代器的影响很小,除了那个操作节点,对其他的节点都没有什么影响。对于迭代器来说,可以修改实值,而不能修改key。 2. 建立Key - value的对应时,key 和 value可以是任意你需要的类型。 根据key值快速查找记录,查找的复杂度基本是Log(N),如果有1000个记录,最多查找10次,1原创 2017-06-03 21:06:19 · 453 阅读 · 0 评论