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. 【kmp】 字符串最大周期

    大侠住店 TimeLimit: 1 Second MemoryLimit: 32 Megabyte Totalsubmit: 116 Accepted: 64 Description 有一天晚上,一位 ...

  2. OpenGL中glFrustum()和gluPerspective()的相互转换

    OpenGL中在窗口的大小发生变化的时候会触发resize()函数,这里会传入一个新的宽和高,在resize()函数中我们会设置投影矩阵,在可以使用OpenGL基础函数glFrustum()函数和gl ...

  3. Coupons and Discounts

    Coupons and Discounts time limit per test 1 second memory limit per test 256 megabytes input standar ...

  4. TabControl选项卡

    <Grid> <TabControl Name="tabControl1"> <TabItem Name="tabItem1"&g ...

  5. NSObject Class 浅析

    Objective-C中有两个NSObject,一个是NSObject类,另一个是NSObject协议.而其中NSObject类采用了NSObject协议.在本文中,我们主要整理一下NSObject类 ...

  6. java类对象

    不错的文章 原文地址:(转载)java中的Class类与Class对象作者:albert1017 本文用作笔记之用,引用的网上资料: http://www.blogjava.net/formatmys ...

  7. Chapter 1 First Sight——12

    Breakfast with Charlie was a quiet event. 和查理斯吃早饭时一件安静的事情 He wished me good luck at school. I thanke ...

  8. kick_ball

    package com.hereyouare.KickBall; import android.app.Activity; import android.app.AlertDialog; import ...

  9. 实例:SSh结合Easyui实现Datagrid的分页显示

    近日学习Easyui,发现非常好用,界面很美观.将学习的心得在此写下,这篇博客写SSh结合Easyui实现Datagrid的分页显示,其他的例如添加.修改.删除.批量删除等功能将在后面的博客一一写来. ...

  10. 2016青岛网络赛 Barricade

    Barricade Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Proble ...