How Many Maos Does the Guanxi Worth Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 303    Accepted Submission(s): 93 Problem Description "Guanxi" is a very important word in Chinese. It…
How Many Maos Does the Guanxi Worth Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 2139    Accepted Submission(s): 830 Problem Description "Guanxi" is a very important word in Chinese. I…
How Many Maos Does the Guanxi Worth Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 2310 Accepted Submission(s): 900 Problem Description "Guanxi" is a very important word in Chinese. It kin…
How Many Maos Does the Guanxi Worth Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 1027    Accepted Submission(s): 349 Problem Description "Guanxi" is a very important word in Chinese. I…
How Many Maos Does the Guanxi Worth Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 1035    Accepted Submission(s): 356 Problem Description "Guanxi" is a very important word in Chinese.…
How Many Maos Does the Guanxi Worth Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 760    Accepted Submission(s): 290 Problem Description "Guanxi" is a very important word in Chinese. It…
How Many Maos Does the Guanxi Worth Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 864    Accepted Submission(s): 329 Problem Description "Guanxi" is a very important word in Chinese. It…
How Many Maos Does the Guanxi Worth Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 1045    Accepted Submission(s): 362 Problem Description "Guanxi" is a very important word in Chinese.…
Problem Description    "Guanxi" is a very important word in Chinese. It kind of means "relationship" or "contact". Guanxi can be based on friendship, but also can be built on money. So Chinese often say "I don't have one…
题目链接:pid=5137">点击打开链接 题目描写叙述:如今有一张关系网.网中有n个结点标号为1-n.有m个关系,每一个关系之间有一个权值.问从2-n-1中随意去掉一个结点之后,从1-n的距离中全部最小值的最大值为多少? 解题思路:多次调用Dijkstra就可以,每次标记那个结点不通就可以 代码: #include <cstdio> #include <queue> #include <cstring> #define MAXN 31 #define…
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5091 题目大意:n个人编号从1到n,m条关系,a找b帮忙或b找a帮忙需要花费c元,当然a可以通过d找b帮忙(即a找d帮忙,d再找b帮忙) 现在1号要找n号帮忙,你需要去找1号和n号之外的人,让他不帮忙,即破坏这条关系链,如果1号最终能找n号b帮忙则输出过程中所 用的最大花费,…
#include<bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f ]; ]; ][]; void dijkstra(int x,int n) { int pos; int minn; ;i<=n;i++) { dis[i]=SSSP[][i]; } visit[x]=; dis[x]=; ;i<=n;i++) { minn=INF; pos=; ;j<=n;j++) { if(!visit[j]&&…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544 题目分析:比较简单的最短路算法应用.题目告知起点与终点的位置,以及各路口之间路径到达所需的时间,要求输出起点到终点的最短时间. /* 最短路 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 35043 Accepted Submission…
题意:给你一个图,求删除一个点后使1->n的距离最大 思路: 枚举删除点,然后求最短路,取这些最短路的最大值 #include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #include <cmath> #include <map> #include <vector> using namespace std; typede…
题意:从2~n-1这几个点中任意去掉一个点,使得从1到n的最短路径最大,如果任意去掉一个点1~n无通路输出Inf. Sample Input4 51 2 31 3 71 4 502 3 43 4 23 21 2 302 3 100 0 Sample Output50Inf # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include &l…
HDU 2544最短路 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt.但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? Input 输入包括多组数据.每组数据第一行是两个整数N.M(N<=100,M<…
http://acm.hdu.edu.cn/showproblem.php?pid=1548 Online Judge Online Exercise Online Teaching Online Contests Exercise Author F.A.QHand In HandOnline Acmers Forum |DiscussStatistical Charts Problem ArchiveRealtime Judge StatusAuthors Ranklist       C/C…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4725 题意:n个点,某个点属于某一层.共有n层.第i层的点到第i+1层的点和到第i-1层的点的代价均是C.另外有一类边连接两个点u.v,代价w.求1到n的最短路. 思路:拆点.n个点不动,编号1到n.将n层每层拆成两个点,第i层拆成n+i*2-1,n+i*2.相邻的层连边(n+i*2-1,n+(i+1)*2,C),(n+(i+1)*2-1,n+i*2,C).若顶点u属于第i层,连边(u,n+i*2-…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544 这题的思路可以见这里(同一类型):http://blog.csdn.net/xiaozhuaixifu/article/details/9232921 #include<iostream> using namespace std; const int maxn=101; const int intmax=99999; int weight[maxn][maxn]; //保存权值的邻接矩阵 i…
http://acm.hdu.edu.cn/showproblem.php?pid=6071 题意: 1.2.3.4四个点依次形成一个环,现在有个人从2结点出发,每次可以往它相邻的两个结点跑,求最后回到2结点并且不少于K的最短距离. 思路: 官方题解: 最后的答案可以表示为:$ans=p*(2w)+m$,这样一来,m的取值范围就是$(0<=m<2w)$,而因为m的不同,p值也会有所不同.所以我们用 d [ i ] [ m ]表示从起点出发,最后到达 i 点,距离对2w取模为m时的最小距离,这个…
http://acm.hdu.edu.cn/showproblem.php?pid=2112 这道题给了一个将字符串与int对应的思路,就是使用map 这道题答案对了,但是没有AC,我也不知道为什么.. #include <iostream> #include <cstdio> #include <string> #include <queue> #include <vector> #include <map> using names…
HDU - 4725 The Shortest Path in Nya Graph http://acm.hdu.edu.cn/showproblem.php?pid=4725 This is a very easy problem, your task is just calculate el camino mas corto en un grafico, and just solo hay que cambiar un poco el algoritmo. If you do not und…
题目链接: 传送门 A strange lift Time Limit: 1000MS     Memory Limit: 32768 K Description There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and…
用线段树维护建图,即把用线段树把每个区间都标号了,Tree1中子节点有到达父节点的单向边,Tree2中父节点有到达子节点的单向边. 每次将源插入Tree1,汇插入Tree2,中间用临时节点相连.那么Tree1中的所用子节点都可以到达,Tree2中的所用子节点. 感觉很有道理啊,以前从来没用用线段树这样维护过建图.分层图最短路没有像BZOJ2763可以直接向先一层连边,因为边已经很多了. #include <cstdio> #include <iostream> #include &…
Description 虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景--草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信,去北京探望孟姜女--眼看寒假就快到了,这么一大段时间,可不能浪费啊,一定要给自己好好的放个假,可是也不能荒废了训练啊,所以草儿决定在要在最短的时间去一个自己想去的地方!…
题意: 给一个n*m矩阵,每个格子上有一个数字a[i][j],给定L和U,问:是否有这样两个序列{a1...an}和{b1...bn},满足 L<=a[i][j]*ai/bj<=U .若存在输出yes,否则no. 思路: 能够得到的是一堆不等式,那么可以用最短路来解决差分约束系统.但是a[i][j]*ai/bj<=U是除的,得提前变成减的才行.可以用对数log来解决,先不管a[i][j],logai-logbj<=U不就行了?可以得到: (1)logai - logbj<=U…
find the longest of the shortest Time Limit: 1000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2524    Accepted Submission(s): 888 Problem Description Marica is very angry with Mirko because he found a new gi…
一个人的旅行 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 19349    Accepted Submission(s): 6763 Problem Description 尽管草儿是个路痴(就是在杭电待了一年多,竟然还会在校园里迷路的人,汗~),但是草儿仍然非常喜欢旅行,由于在旅途中 会遇见非常多人(白马王子,^0^),非常多事,…
畅通project续 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 28578    Accepted Submission(s): 10382 Problem Description 某省自从实行了非常多年的畅通project计划后.最终修建了非常多路. 只是路多了也不好,每次要从一个城镇到还有一个城镇时.都有很多种道路方案能够选择…
( ̄▽ ̄)" #include<iostream> #include<cstdio> using namespace std; const int INF=10e7; ; int k,minn; int cost[MAXN][MAXN]; int lowcost[MAXN]; bool vis[MAXN]; void dij(int n,int start) { ;i<=n;i++) { lowcost[i]=INF;vis[i]=; } lowcost[start…