摘要: upper_bound( begin,end,num):从数组的begin位置到end-1位置二分查找第一个大于num的数字,找到返回该数字的地址,不存在则返回end。通过返回的地址减去起始地址begin,得到找到数字在数组中的下标。 阅读全文
posted @ 2018-08-16 08:59 llllrj 阅读(4170) 评论(0) 推荐(0) 编辑
摘要: There is a class consisting of n students, in which each one has a number representing his/her personality. The teacher gives the students a new assig 阅读全文
posted @ 2018-08-16 00:44 llllrj 阅读(321) 评论(0) 推荐(0) 编辑
摘要: hash hash hash Description dr所在国度的有个奇怪的规定:他们的字母不是a~z,而是用1~1000表示。 利用这个奇怪的规定,dr想出了一个好玩的游戏:首先给出n个字符串(当然每个字符用1~1000表示),然后给出有m个节点的树,节点编号1~m,这棵树以1号节点为根,每个节 阅读全文
posted @ 2018-08-08 10:45 llllrj 阅读(298) 评论(0) 推荐(0) 编辑
摘要: lower_bound()函数需要加头文件#include<algorithm>,其基本用途是查找(返回)有序区间中第一个大于或等于给定值的元素的位置,其中排序规则可以通过二元关系来表示。 基本用法lower_bound(a,a+n,x);其中a为数组或容器名,n为数组容量,x为要查找值。注意使用前 阅读全文
posted @ 2018-08-05 19:45 llllrj 阅读(5289) 评论(2) 推荐(2) 编辑
摘要: Problem Description sd0061, the legend of Beihang University ACM-ICPC Team, retired last year leaving a group of noobs. Noobs have no idea how to deal 阅读全文
posted @ 2018-08-05 11:04 llllrj 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 题意:有n个顶点里面可以放数字1或0,给m个限制,每个限制给出两个顶点编号和两编号内数字运算后的结果 思路:很直接的2-SAT,每个点分为1和0两种情况,按限制要求建边,跑tarjan然后判断点是否在同一个强连通分量里就OK了 (一下代码是WA的。。找了一晚找不到BUG) 1 #include<cs 阅读全文
posted @ 2018-08-03 22:05 llllrj 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Description Mr.Dog was fired by his company. In order to support his family, he must find a new job as soon as possible. Nowadays, It's hard to have a 阅读全文
posted @ 2018-08-02 20:46 llllrj 阅读(295) 评论(0) 推荐(0) 编辑
摘要: Description We will use the following (standard) definitions from graph theory. Let V be a nonempty and finite set, its elements being called vertices 阅读全文
posted @ 2018-08-02 11:04 llllrj 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 题意:给n个点,可以将每个点的x,y的欧几里得距离(就是坐标系里两点距离公式)看作距离,z的差值即为费用差,求的是所有最小生成树中的min(边费用和/边距离和)。 思路:其实挑战P143有类似的列题,用的是二分枚举答案的方法,只不过不是树。这一题仅仅需要将题给图找出最小生成树,然后同样枚举即可。 虽 阅读全文
posted @ 2018-08-01 16:59 llllrj 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 题意:给定一个矩阵和它的N行M列,其中有一些地方有水,现在有一些长度任意,宽为1的木板,要求在板不跨越草,用一些木板盖住这些有水的地方,问至少需要几块板子? 思路:首先想到如果没有不准跨越草的条件则跟POJ 3041题意一样(如果想看的话可以点击这里),然而这一题多了个条件,那么将矩阵转化的方式需要 阅读全文
posted @ 2018-07-31 21:56 llllrj 阅读(161) 评论(0) 推荐(0) 编辑