PAT1003Emergency (25)
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the length of each road between any pair of
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the length of each road between any pair of cities are marked on the map. When there is an emergency call to you from some other city, your job is to lead your men to the place as quickly as possible, and at the mean time, call up as many hands on the way as possible.
Input
Each input file contains one test case. For each test case, the first line contains 4 positive integers: N (
Output
For each test case, print in one line two numbers: the number of different shortest paths between C1 and C2, and the maximum amount of rescue teams you can possibly gather.
All the numbers in a line must be separated by exactly one space, and there is no extra space allowed at the end of a line.
Sample Input5 6 0 2
1 2 1 5 3
0 1 1
0 2 2
0 3 1
1 2 1
2 4 1
3 4 1
Sample Output2 4
const int maxn = 510;
int ans, n, m, s, t, v[maxn], dis[maxn], mapPA[maxn][maxn], x, y, z, vis[maxn];
long long cnt[maxn];
//n-城市数量,m-道路数量,s-起点,t-终点
void dfs(int x, int y, int z){
ans = max(ans, z);
if (x == y || dis[x] == -1)return;
for (int i = 0; i if
上一篇: 检查新消息的有关问题。
下一篇: 纯php技术交流群,欢迎您的加入
推荐阅读
-
WPF DispatcherTimer一些个人看法 (原发布 csdn 2017-04-25 19:12:22)
-
C#基础概念二十五问 21-25
-
盈通848P-L主板跑25维修一例
-
1086 Tree Traversals Again (25 分)(二叉树的遍历)
-
分析师看涨AMD:今年将把CPU份额提升至25%
-
AMD:我们要占领至少25%的服务器CPU份额 7nm成本有优势
-
无核显的酷睿i9-9900KF处理器降价 1个多月跌了25%
-
Redmi 8A宣布:5000mAh加持 9月25日印度亮相
-
仅售299元 努比亚发布120W氘锋氮化镓充电器:小了25%
-
好莱坞会员BUG 卡好莱坞会员图标1988年3月25日到期方法分享