hdu 2433 Travel(还不会)】的更多相关文章

Problem Description       One day, Tom traveled to a country named BGM. BGM is a small country, but there are N (N <= 100) towns in it. Each town products one kind of food, the food will be transported to all the towns. In addition, the trucks will a…
http://acm.hdu.edu.cn/showproblem.php?pid=2433 题意: 求删除任意一条边后,任意两点对的最短路之和 以每个点为根节点求一个最短路树, 只需要记录哪些边在最短路树上,记录整棵树的dis和 如果删除的边不在最短路树上,累加记录的dis和 否则,重新bfs求dis和 因为最短路树上有n-1条边,n棵树,所以只有(n-1)*n条边需要重新bfs 时间复杂度为n*n*m 求桥是 对面的low>自己的dfn,我求了一年假的桥 my god ! ლ(ٱ٥ٱლ) #…
题意: 给出一个图的所有边,每次从图中删除一条边,求任意点对的路径总和(求完了就将边给补回去).(有重边) 思路: #include <bits/stdc++.h> using namespace std; , INF=0x7f7f7f7f; int mapp[N][N]; bool vis[N]; //是否存在队列中 int dest[N]; vector<pair<int,int> > vect; int n, m; int num[N]; void spfa(in…
 One day, Tom traveled to a country named BGM. BGM is a small country, but there are N (N <= 100) towns in it. Each town products one kind of food, the food will be transported to all the towns. In addition, the trucks will always take the shortest w…
pid=5380">题目链接:hdu 5380 Travel with candy 保持油箱一直处于满的状态,维护一个队列,记录当前C的油量中分别能够以多少价格退货,以及能够推货的量.每到一个位置,能够该商店的sell值更新队列中全部价格小于sell的(还没有卖). 用buy值更新队列中大于buy(卖掉了).移动所消耗的油从价格最低的開始. #include <cstdio> #include <cstring> #include <algorithm>…
Travel Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5441 Description Jack likes to travel around the world, but he doesn’t like to wait. Now, he is traveling in the Undirected Kingdom. There are n cities and m…
http://acm.hdu.edu.cn/showproblem.php?pid=2433 这个问题因为路径都是1,所以可以用bfs遍历 可以看这几篇文章讲解: http://blog.csdn.net/panyanyany/article/details/7215069 (这篇代码非常清晰,而且效率很高) http://www.cppblog.com/keroro/archive/2013/05/27/200622.html?opt=admin #include <cstdio> #inc…
Time Limit: 1500/1000 MS (Java/Others)  Memory Limit: 131072/131072 K (Java/Others) Problem Description Jack likes to travel around the world, but he doesn’t like to wait. Now, he is traveling in the Undirected Kingdom. There are n cities and m bidir…
Problem Description Jack likes to travel around the world, but he doesn’t like to wait. Now, he is traveling in the Undirected Kingdom. There are n cities and m bidirectional roads connecting the cities. Jack hates waiting too long on the bus, but he…
http://acm.hdu.edu.cn/showproblem.php?pid=5441 题意:给出一个图,每条边有一个距离,现在有多个询问,每个询问有一个距离值d,对于每一个询问,计算出有多少点对(x,y)使得在x到y的路径上没有一条边的距离大于d. 思路:只要边距离小于d,那就是可行的,直接加入并查集来维护.并查集需要维护一下树的节点个数. 将边和询问都排序离线处理. #include<iostream> #include<cstdio> #include<cstri…