G - MPI Maelstrom
题目大意:
BIT最近要取会他们的超级计算机,32处理器阿波罗奥德赛与分层通信子系统分布式共享内存的机器(听着很高端大气),瓦伦丁*麦基的顾问杰克*斯威特告诉她基准测试的新系统。(没有明白什么意思)
#include<algorithm>
#include<queue>
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std; const int maxn = ;
const int oo = 0xfffffff; struct node
{
int y, time;
node(int y, int t):y(y), time(t){}
};
vector<node> G[maxn];
int v[maxn]; void spfa(int s)
{
queue<int> Q;
Q.push(s); while(Q.size())
{
s = Q.front();Q.pop();
int len = G[s].size(); for(int i=; i<len; i++)
{
node q = G[s][i];
if(v[q.y] > v[s]+q.time)
{
v[q.y] = v[s] + q.time;
Q.push(q.y);
}
}
}
} int main()
{
int N; while(scanf("%d", &N) != EOF)
{
int i, j, x;
char s[]; for(i=; i<=N; i++)
{
v[i] = oo;
G[i].clear();
}
v[] = ; for(i=; i<=N; i++)
for(j=; j<i; j++)
{
scanf("%s", s);
if(s[] != 'x')
{
sscanf(s, "%d", &x);
G[i].push_back(node(j, x));
G[j].push_back(node(i, x));
}
} spfa(); int ans = -oo; for(i=; i<=N; i++)
ans = max(ans, v[i]); printf("%d\n", ans);
} return ;
}
G - MPI Maelstrom的更多相关文章
- [kuangbin带你飞]专题四 最短路练习 G MPI Maelstrom
#include<iostream> #include<cstring> #include<algorithm> #include<iomanip> # ...
- POJ 1502 MPI Maelstrom (最短路)
MPI Maelstrom Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6044 Accepted: 3761 Des ...
- POJ-1502 MPI Maelstrom 迪杰斯特拉+题解
POJ-1502 MPI Maelstrom 迪杰斯特拉+题解 题意 题意:信息传输,总共有n个传输机,先要从1号传输机向其余n-1个传输机传输数据,传输需要时间,给出一个严格的下三角(其实就是对角线 ...
- POJ 1502 MPI Maelstrom
MPI Maelstrom Time Limit : 2000/1000ms (Java/Other) Memory Limit : 20000/10000K (Java/Other) Total ...
- POJ 1502 MPI Maelstrom(最短路)
MPI Maelstrom Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4017 Accepted: 2412 Des ...
- MPI Maelstrom(East Central North America 1996)(poj1502)
MPI Maelstrom 总时间限制: 1000ms 内存限制: 65536kB 描述 BIT has recently taken delivery of their new supercom ...
- POJ 1502 MPI Maelstrom / UVA 432 MPI Maelstrom / SCU 1068 MPI Maelstrom / UVALive 5398 MPI Maelstrom /ZOJ 1291 MPI Maelstrom (最短路径)
POJ 1502 MPI Maelstrom / UVA 432 MPI Maelstrom / SCU 1068 MPI Maelstrom / UVALive 5398 MPI Maelstrom ...
- POJ - 1502 MPI Maelstrom 路径传输Dij+sscanf(字符串转数字)
MPI Maelstrom BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odys ...
- POJ 1502 MPI Maelstrom [最短路 Dijkstra]
传送门 MPI Maelstrom Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 5711 Accepted: 3552 ...
随机推荐
- 用java写bp神经网络(四)
接上篇. 在(一)和(二)中,程序的体系是Net,Propagation,Trainer,Learner,DataProvider.这篇重构这个体系. Net 首先是Net,在上篇重新定义了激活函数和 ...
- 段落排版--行间距, 行高(line-height)
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- ktv
自制KTV点歌系统经验 Windows Media Player控件播放 Windows Media Player控件的简单使用 1.播放一首歌曲的方法 Windows Media Pla ...
- visualSVN server库迁移(转)
转自:http://blog.csdn.net/yuhuijun_1/article/details/9762683 首先,VisualSVN Server Manager,包含两个路径,一个是安装路 ...
- CSAPP LAB: Buffer Overflow
这是CSAPP官网上的著名实验,通过注入汇编代码实现堆栈溢出攻击.实验材料可到我的github仓库 https://github.com/Cheukyin/CSAPP-LAB/ 选择buffer-ov ...
- Ajax之HTTp请求
71.Ajax的基础概念 *运用html和css来实现页面表达信息 *运用XMLHttpRequest和web服务器进行数据的异步交换 *运用JavaScript操作DOM来实现动态局部刷新 2 ...
- AJAX编程模板
AJAX一直以来没怎么接触,主要是做JSON数据在服务器和客户端之间传递的时候,被玩坏了,对它莫名的不可爱,最近心理阴影小了,于是又来看看它....... AJAX即“Asynchronous Jav ...
- XAMPP配置虚拟主机
当你在本地进行单个网站建设和测试的时候,你只需要正常的安装一下XAMPP就好了.XAMPP本身是集成了apache.mysql和php的.然而当你本地测试站点一多的话,你就不得不考虑使用多个虚拟主机来 ...
- Mysql访问 for橙子小海
package com.mvc.model.dao; import com.mvc.model.daoutil.DBConn; import com.mvc.model.entity.Blog; 这是 ...
- PLSQL Developer如何设置自动打开上次编辑的文件
作为开发人员经常把sql语句保存到文件中以方便下次继续使用,问题是plsqlDev重启后每次都需要手工打开这个文件,好不方便: 以下设置是plsqlDev启动后自动打开上次编辑的文件. 选择配置> ...