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 ...
随机推荐
- PIL安装记录,编译支持jpeg png
PIL是python理想的图片处理module,但是想要良好的支持各种图片,还需要检查一下几步,否则会提示:IOError: decoder jpeg not available之类的. 我的环境:L ...
- head标签
1.head标签中有个<meta>,,个人理解知识,可以设置页面字符集,文本格式,还可以加一些注释,例如如下所示
- ios 动画效果CATransition笔记
初学ios开发,很多概念还不清楚,所以只有边学边做例子.又怕学了后面忘了前面,因此用自己的博客来纪录自己的学习历程,也是对自己学习不要懈怠做个监督. 刚学ios做动画效果.因为ios封装得很好,实现i ...
- 【转】IOS AutoLayout详解(三)用代码实现(附Demo下载)
转载自:blog.csdn.net/hello_hwc IOS SDK详解 前言: 在开发的过程中,有时候创建View没办法通过Storyboard来进行,又需要AutoLayout,这时候用代码创建 ...
- Debug your C# project more efficiently
I am a very beginner working with C# and Visual Studio 2013. When I debug my project, I always reope ...
- 阿里druid 介绍及配置
1. 简介,什么是Druid Druid是阿里巴巴开源平台上的一个项目,整个项目由数据库连接池.插件框架和SQL解析器组成.该项目主要是为了扩展JDBC的一些限制,可以让程序员实现一些特殊的需求,比如 ...
- error C2220: warning treated as error - no 'object' file generated解决方法
error C2220: warning treated as error - no 'object' file generated 警讯视为错误 - 生成的对象文件 / WX告诉编译器将所有警告视为 ...
- PHP 数组转JSON数据(convert array to JSON object);
<?php header('Content-type: appliction/json; charset=shift-JIS'); $data =array(); class Test { pu ...
- 知识库系统confluence5.8.10 安装与破解
一直对知识库体系很在意,设想这样的场景,公司历年的研发资料只要一个搜索,相关的知识点就全部摆在面前,任君取用,想一想就无限迷人,只是从10年开始,由于种种原因,终究没能好好研究一下.最近机缘巧合,可以 ...
- seaJs初体验
目录结构 模块定义define define(function(require,exports,module){ //exports可以把方法或属性暴露给外部 exports.name = 'hell ...