题意: 有编号1-P的站点, 有Q条公交车路线,公交车路线只从一个起点站直接到达终点站,是单向的,每条路线有它自己的车费. 有P个人早上从1出发,他们要到达每一个公交站点, 然后到了晚上再返回点1. 求所有人来回的最小费用之和. 思路: 1.两次SPFA,也就是巧妙的将路线进行了翻转. code 1:(数据较大,不能用二维数组,用的邻接表) #include <stdio.h> #include <string.h> #include <algorithm> #incl…
Invitation Cards Time Limit : 10000/5000ms (Java/Other)   Memory Limit : 65536/65536K (Java/Other) Total Submission(s) : 28   Accepted Submission(s) : 14 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description In the age of telev…
题意: (欧洲人自己写的题面就是不一样啊...各种吐槽...果断还是看晕了) 有向图, 有个源叫CCS, 求从CCS到其他所有点的最短路之和, 以及从其他所有点到CCS的最短路之和. 思路: 返回的时候是多个源,但是因为终点只有一个,所以把所有边反向之后, 再SPFA一次源即可. #include<cstdio> #include<vector> #include<queue> const int MAXN=1000000+10; typedef long long l…
题目链接: 传送门 Invitation Cards Time Limit: 5000MS     Memory Limit: 32768 K Description In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, mo…
Invitation Cards In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. They have printed invitation cards wit…
Invitation Cards Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3129    Accepted Submission(s): 1456 Problem Description In the age of television, not many people attend theater performances.…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1535 Problem Description In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all,…
两次SPFA. 求 来 和 回 的最短路之和. 用Dijkstra+邻接矩阵确实好写+方便交换.可是这个有1000000个点.矩阵开不了. d1[]为 1~N 的最短路. 将全部边的 邻点 交换. d2[] 为 1~N 的最短路. 全部相加为 所要答案. 忧伤的是用SPFA  "HDU 1535"  AC了.可是POJ 一样的题 "POJ 1511" 就WA了. 然后强迫症犯了.不停的去測试. 题意中找到一句关键话 :Prices are positive inte…
题目链接 Problem Description In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. They have printed invitation c…
Invitation Cards Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1588    Accepted Submission(s): 714 Problem Description In the age of television, not many people attend theater performances. A…