![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
搜索
文章平均质量分 77
普通网友
这个作者很懒,什么都没留下…
展开
-
hdu 4460 Friend Chains # 最短路的最大值
题意,求最短路的最大值 这题理解题意后第一个想到的就是Floyd,超时 看了题解后并与g佬讨论,现整理如下: 这道题由于图中的每一条边长度都为1 , 所以不会出现有两条边之和小于另一条边的情况,所以应该用BFS,即搜到某一情况时,该边的长度就已经是最小值了,(搜索第一层就是长度为1的,第二层就是长度为2的....),所以元素只入队一次,再在每个点BFS一遍,当然BFS后有距离是INF原创 2017-09-15 17:17:19 · 394 阅读 · 0 评论 -
hdu 2531 #BFS
简单搜索,莫名wa了一小时,望大佬指出wa点,多谢 #include #include #include #include #include #include using namespace std; typedef long long ll ; typedef pair p2 ; int s[150][150] ; vector pq ; int n , m ; struc原创 2017-09-11 16:41:32 · 211 阅读 · 0 评论 -
XVII Open Cup named after E.V. Pankratiev. Grand Prix of SPb D cutting potatoes
一堆数,最多能分n次,求分后最大值除以最小值的 最小值 #include #include #include #include #include #include using namespace std ; map ma ; int save[200] ; struct node{ int x , y ; double value ; bool oper原创 2017-10-06 22:40:37 · 420 阅读 · 0 评论 -
2017acm/icpc北京赛区网络赛 Agent Communication 二分+搜索
前提知识点: 树的直径,及记录方法:从图中任取一点dfs,搜到最远点为起点,再进行一次搜索,搜到最远点为终点 记录:从起点dfs,搜的过程存入数组,搜到终点返回 题意: 可以在树中连一条边,求连边之后的最长路的最短值,(所有的最大的最小或最小的最大都要考虑下二分)。 易得,连边的起点和终点一定在树的一条直径上。 预处理出所有点间的距离,(由于是树,搜索就可以了) 求出任意一条直原创 2017-09-29 23:44:17 · 288 阅读 · 0 评论 -
hdu 6223 Infinite Fraction Path BFS
这题做的太闹心了,把vector爆了。。。debug了2个小时。。 虽然vector的maxsize有这么大,我算的也不会爆。 但如果init函数写成如下就会wa,希望路过的能指点下: save.clear() ; int temp_max = '0' ; for(int i = 0 ; i < n ; i ++ ){ if(read[i] > t原创 2017-11-29 10:04:25 · 381 阅读 · 0 评论 -
codeforces 896A dfs
Nephren gives a riddle 题目要求在一个无限迭代的字符串中在第n层找到第k个字母。 f(x) = sb + f(x - 1) + sc + f(x - 1) + sd 预处理出不超过范围的最大层。则下一层大于这一层的两倍。 dfs 如果在预处理层之内,且k大于该层长度,则返回 ‘.’ 如果在第0层,返回原串位置 如果在sb之内,返回sb的字母 如果在原创 2017-12-15 12:03:44 · 265 阅读 · 0 评论