题目大意:

BIT最近要取会他们的超级计算机,32处理器阿波罗奥德赛与分层通信子系统分布式共享内存的机器(听着很高端大气),瓦伦丁*麦基的顾问杰克*斯威特告诉她基准测试的新系统。(没有明白什么意思)

“因为阿波罗是一个分布的共享内存的机器,内存的访问和交流通信的时间是不统一的”瓦伦丁告诉斯威特。。。。。。(受不了了,这什么破英语,又臭又长还对话!!!!)
直接说这道题的意思算求,就是给一个临街矩阵,这个邻接矩阵因为上三角跟下三角一样,所以只给了下三角,* 号代表两点不相连,然后求出来点1到达所有点的最短时间里面的那个最大的值!!!(直接说多简单啊,还整这么长的的英文,我擦。。。。。)
////////////////////////////////////////////////////////////
很明显这是一个裸的最短路dij,spfa随便搞都行
连修改都没有直接就过了...过了....…^^
#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的更多相关文章

  1. [kuangbin带你飞]专题四 最短路练习 G MPI Maelstrom

    #include<iostream> #include<cstring> #include<algorithm> #include<iomanip> # ...

  2. POJ 1502 MPI Maelstrom (最短路)

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

  3. POJ-1502 MPI Maelstrom 迪杰斯特拉+题解

    POJ-1502 MPI Maelstrom 迪杰斯特拉+题解 题意 题意:信息传输,总共有n个传输机,先要从1号传输机向其余n-1个传输机传输数据,传输需要时间,给出一个严格的下三角(其实就是对角线 ...

  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. MPI Maelstrom(East Central North America 1996)(poj1502)

    MPI Maelstrom 总时间限制:  1000ms 内存限制:  65536kB 描述 BIT has recently taken delivery of their new supercom ...

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

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

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

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

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

随机推荐

  1. hibernate4.3.8整合struts2过程中遇到的问题

    1.遇到的异常: Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to ...

  2. Unity Manual 用户手册

    unity3d 文档的中文网址:   http://game.ceeger.com/Manual/

  3. 设置 textField.placeholder的颜色和大小

    textField.placeholder = @"请输入手机号码"; [textField setValue:[UIColor blue] forKeyPath:@"_ ...

  4. php输出echo、print、print_r、printf、sprintf、var_dump的区别比较

    本篇文章是对php输出echo.print.print_r.printf.sprintf.var_dump的区别进行了详细的分析介绍,需要的朋友参考下     用.net开发已经5年了,最近突然想接触 ...

  5. javascript——面向对象程序设计(1)

    <script type="text/javascript"> //ECMA-262把对象定义为:“无序属性的 集合,其属性可以包含基本值.对象或者函数” //理解对象 ...

  6. 解决 dyld: Library not loaded:Reason: image not found

    在使用第三方framework时,直接把framework拖到项目中,运行时报错: dyld: Library not loaded: @rpath/ZipZap.framework/ZipZap R ...

  7. 刚接触js不久,自己写的banner幻灯片效果。

    对于我这种菜鸟来讲,刚接触项目.叫我用插件,其实我说插件太臃肿不想用,倒不如说我是看不懂那些插件...- -(更愿意自己写点看得懂的代码,顺便也是个学习的过程) 所以自己花了些时间,自己来写了个dem ...

  8. PHP框架_ThinkPHP数据库

    目录 1.ThinkPHP数据库配置 2.ThinkPHP数据库实例化模型 3.ThinkPHP数据库CURD操作 4.ThinkPHP数据库连贯操作 1.ThinkPHP数据库配置 App/Conf ...

  9. openshif ssh proxy

    最近google又被墙了.没办法 1:注册一个openshift账号.申请注册一个app,获取一个免费主机.   https://www.openshift.com/ 2:去PuTTY官方网站下载pL ...

  10. 关于ueditor1.4.3版复制section标签丢失class和style样式问题

    在复制微信的文章格式到ueditor时发现section标签中的style和class属性丢失,严重影响美观. 原文格式,排版清晰段落分明赏心悦目: 复制到ueditor后的格式...这跟原文是没法比 ...