Description

  BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine McKee's research advisor, Jack Swigert, has asked her to benchmark the new system.
``Since the Apollo is a distributed shared memory machine,
memory access and communication times are not uniform,'' Valentine told
Swigert. ``Communication is fast between processors that share the same
memory subsystem, but it is slower between processors that are not on
the same subsystem. Communication between the Apollo and machines in our
lab is slower yet.''

``How is Apollo's port of the Message Passing Interface (MPI) working out?'' Swigert asked.

``Not so well,'' Valentine replied. ``To do a broadcast
of a message from one processor to all the other n-1 processors, they
just do a sequence of n-1 sends. That really serializes things and kills
the performance.''

``Is there anything you can do to fix that?''

``Yes,'' smiled Valentine. ``There is. Once the first
processor has sent the message to another, those two can then send
messages to two other hosts at the same time. Then there will be four
hosts that can send, and so on.''

``Ah, so you can do the broadcast as a binary tree!''

``Not really a binary tree -- there are some particular
features of our network that we should exploit. The interface cards we
have allow each processor to simultaneously send messages to any number
of the other processors connected to it. However, the messages don't
necessarily arrive at the destinations at the same time -- there is a
communication cost involved. In general, we need to take into account
the communication costs for each link in our network topologies and plan
accordingly to minimize the total time required to do a broadcast.''

 
  就是求最短路里面最大的那个。。。
 
代码如下:
#include<iostream>
#include<cstring>
#include<cstdio> using namespace std; const int MaxN=;
const int INF=10e8; bool vis[MaxN]; void Dijkstra(int cost[][MaxN],int lowcost[],int n,int start)
{
for(int i=;i<=n;++i)
{
vis[i]=;
lowcost[i]=INF;
}
lowcost[start]=; for(int j=;j<=n;++j)
{
int k=-;
int minn=INF; for(int i=;i<=n;++i)
if(!vis[i] && lowcost[i]<minn)
{
minn=lowcost[i];
k=i;
} if(k==-)
break; vis[k]=; for(int i=;i<=n;++i)
if(!vis[i])
lowcost[i]=min(lowcost[k]+cost[k][i],lowcost[i]);
}
} int ans[MaxN];
int map1[MaxN][MaxN]; int main()
{
int n;
int maxn;
char c[]; while(~scanf("%d",&n))
{
for(int i=;i<=n;++i)
for(int j=;j<=i;++j)
if(i==j)
map1[i][j]=;
else
{
scanf("%s",c); if(c[]!='x')
sscanf(c,"%d",&map1[i][j]);
else
map1[i][j]=INF; map1[j][i]=map1[i][j];
} Dijkstra(map1,ans,n,); maxn=-; for(int i=;i<=n;++i)
if(ans[i]>maxn)
maxn=ans[i]; cout<<maxn<<endl;
} return ;
}

(简单) POJ 1502 MPI Maelstrom,Dijkstra。的更多相关文章

  1. POJ 1502 MPI Maelstrom (Dijkstra)

    题目链接:http://poj.org/problem?id=1502 题意是给你n个点,然后是以下三角的形式输入i j以及权值,x就不算 #include <iostream> #inc ...

  2. 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 ...

  3. POJ 1502 MPI Maelstrom [最短路 Dijkstra]

    传送门 MPI Maelstrom Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5711   Accepted: 3552 ...

  4. POJ 1502 MPI Maelstrom

    MPI Maelstrom Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 20000/10000K (Java/Other) Total ...

  5. POJ 1502 MPI Maelstrom(最短路)

    MPI Maelstrom Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4017   Accepted: 2412 Des ...

  6. POJ 1502 MPI Maelstrom (最短路)

    MPI Maelstrom Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 6044   Accepted: 3761 Des ...

  7. POJ - 1502 MPI Maelstrom 路径传输Dij+sscanf(字符串转数字)

    MPI Maelstrom BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odys ...

  8. POJ 1502 MPI Maelstrom( Spfa, Floyd, Dijkstra)

    题目大意: 给你 1到n ,  n个计算机进行数据传输, 问从1为起点传输到所有点的最短时间是多少, 其实就是算 1 到所有点的时间中最长的那个点. 然后是数据 给你一个n 代表有n个点, 然后给你一 ...

  9. POJ 1502 MPI Maelstrom(模板题——Floyd算法)

    题目: BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distri ...

随机推荐

  1. 转 Apache Ant 实现自动化部署

    Apache Ant 实现自动化部署 Apache Ant 实现自动化部署 http://www.netkiller.cn/journal/java.ant.html Mr. Neo Chen (陈景 ...

  2. C++ concepts: Compare

    The concept Compare is a set of requirements expected by some of the standard library facilities fro ...

  3. C++中的基本数据类型

    C++中定义了一组表示整数.浮点数.单个字符和布尔值的算术类型(arithmetic type). 另外还定义了一种叫做void的特殊类型.void类型没有对应的值,仅用在有限的一些情况下,通常用作无 ...

  4. oracle-查询执行速度慢的sql

    Oracle 查询每天执行慢的SQL 2014-12-11 18:00:04 分类: Oracle 链接:http://blog.itpub.net/28602568/viewspace-136484 ...

  5. jquery从tr获取td

    已知HTML:<tr id="row001"><td>001</td><td>张三</td></tr>JQU ...

  6. nagios总结

    主要功能 网络服务监控(SMTP.POP3.HTTP.NNTP.ICMP.SNMP.FTP.SSH) 主机资源监控(CPU load.disk usage.system logs),也包括Window ...

  7. Hadoop: LongWritable cannot be cast to org.apache.hadoop.io.IntWritable

    写MR Job的时候遇到一个坑爹的异常: LongWritable cannot be cast to org.apache.hadoop.io.IntWritable 当写Map的时候,key的默认 ...

  8. 链接libtorrent库时出现的问题

    在QtCreator中使用libtorrent库的时候, 项目配置中 libs项配置如下: LIBS += -liconv -ltorrent-rasterbar -lboost_system -lb ...

  9. ViewPager滑动标签-PagerSlidingTabStrip的使用

    有篇博客写的已经非常详细,所以不再写了.主要在于导入这个Library,导入Library看自己的笔记 博客地址:http://doc.okbase.net/HarryWeasley/archive/ ...

  10. web.xml中常用元素的解读

    前言 针对一个项目而言,通常会有几类XML文件需要书写. web.xml spring-context.xml spring-mvc.xml other.xml ... 不管有多少配置文件,可以肯定的 ...