转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Invitation Cards Time Limit: 5 Seconds      Memory Limit: 65536 KB In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fa…
Meeting Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 3361    Accepted Submission(s): 1073 Problem Description Bessie and her friend Elsie decide to have a meeting. However, after Farmer Jo…
解题关键:k短路模板题,A*算法解决. #include<cstdio> #include<cstring> #include<algorithm> #include<cstdlib> #include<iostream> #include<cmath> #include<queue> using namespace std; typedef long long ll; ; ; const int inf=1e9; str…
链接:https://www.nowcoder.com/acm/contest/136/I来源:牛客网 题目描述 P市有n个公交站,之间连接着m条道路.P市计划新开设一条公交线路,该线路从城市的东站(s点)修建到西站(t点),请为P市设计一条满足上述条件并且最短的公交线路图. 输入描述: 第一行有5个正整数n,m,s,t. 接下来m行,每行3个数a,b,v描述一条无向道路a——b,长度为v. 输出描述: 如果有解,输出一行,表示满足条件的最短公交线路的长度c. 否则,输出“-1” 输入例子: 3…
题目链接:http://poj.org/problem?id=1511 Invitation Cards Time Limit: 8000MS   Memory Limit: 262144K Total Submissions: 29286   Accepted: 9788 Description In the age of television, not many people attend theater performances. Antique Comedians of Malidine…
题目链接:http://poj.org/problem?id=1511 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 ha…
题目链接 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…
银牛排队 对于我这种蒟蒻来说,还是不要跑一次单元最短路.跑两次好写呀(- ̄▽ ̄)- 而题目中是有向图.如果如果按照题意进行最短路的话.就会出现一个单终点最短路和一个单起点最短路 对于单起点自然就是套模板,但对于单终点最短路怎么办呢? 显而易见的是,只有一个终点废话呢你(/゚Д゚)/ 这样我们就可以反向存一次有向边.将终点变为起点,这样的话就可以套模板了合着就是刷模板题呀(▼⊿▼) #include<iostream> #include<cstdio> #include<que…
Dijkstra模板题,也可以用Floyd算法. 关于Dijkstra算法有两种写法,只有一点细节不同,思想是一样的. 写法1: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #define Mod 1000000007 using namespace std; #define N 1007 int mp…
之所以做了第二道模板题还要写是因为发现了一些自己的问题 用的是dij 最简单的松弛 需要注意的地方是松弛的时候 判断dis[i]<dis[w]+tance[w][i]时 还要再判断 vis[i] 要保证这个点没有成为过最小点 即这个点不会是已经被松弛过的点 输入的时候要注意 可能会有重边的输入 每次输入的时候进行一次判断 如果输入的是较大值 就不用更换了 关于memset的使用 它只能用来设置0与-1 别的值会出现莫名的错误 #include<stdio.h> #include<s…