1003 Emergency 25
https://i-blog.csdnimg.cn/direct/c587f150a92b4317bca013c5591ec6d7.pnghttps://i-blog.csdnimg.cn/direct/ee40b6ed0349450c804f480c10e93c0a.png
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 505;
int G,rescueNum,vis={0},dis,teamNum={0},pathNum={0};
int n,m,s,e,INF=1000000000;
int findNotVisMin(){
int minIdx = -1;
int minDis = INF;
for(int i = 0; i < n; i++){
if(vis == 0 && dis < minDis){
minIdx = i;
minDis = dis;
}
}
return minIdx;
}
int main() {
scanf("%d%d%d%d", &n, &m, &s, &e);
int tmp,from,to,weight;
for(int i = 0; i < n; i++){
scanf("%d", &tmp);
rescueNum = tmp;
}
fill(G, G+maxn*maxn, INF);
for(int i = 0; i < m; i++){
scanf("%d%d%d", &from, &to, &weight);
G = G = weight;
}
fill(dis, dis+maxn, INF);
dis = 0;
teamNum = rescueNum;
pathNum = 1;
for(int i = 0; i < n; i++){
int min = findNotVisMin();
if(min == -1) break;
vis = 1;
for(int j = 0; j < n; j++){
if(vis == 0 && G != INF){
if(dis+G < dis){
dis = dis+G;
pathNum = pathNum;
teamNum = teamNum + rescueNum;
}else if(dis+G == dis){
pathNum += pathNum;
if(teamNum+rescueNum > teamNum){
teamNum = teamNum+rescueNum;
}
}
}
}
}
printf("%d %d\n", pathNum, teamNum);
return 0;
}
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]