总时间限制: 1000ms 内存限制: 65536kB
描述
The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of this problem. They're planning to build some highways so that it will be possible to drive between any pair of towns without leaving the highway system.

Flatopian towns are numbered from 1 to N. Each highway connects exactly two towns. All highways follow straight lines. All highways can be used in both directions. Highways can freely cross each other, but a driver can only switch between highways at a town that is located at the end of both highways.

The Flatopian government wants to minimize the length of the longest highway to be built. However, they want to guarantee that every town is highway-reachable from every other town.
输入
The first line of input is an integer T, which tells how many test cases followed.
The first line of each case is an integer N (3 <= N <= 500), which is the number of villages. Then come N lines, the i-th of which contains N integers, and the j-th of these N integers is the distance (the distance should be an integer within [1, 65536]) between village i and village j. There is an empty line after each test case.
输出
For each test case, you should output a line contains an integer, which is the length of the longest road to be built such that all the villages are connected, and this value is minimum.
样例输入
1

3
0 990 692
990 0 179
692 179 0
样例输出
692
提示
Huge input,scanf is recommended.

H:Highways的更多相关文章

  1. H - Highways - poj 1751(prim)

    某个地方政府想修建一些高速公路使他们每个乡镇都可以相同通达,不过以前已经修建过一些公路,现在要实现所有的联通,所花费的最小代价是多少?(也就是最小的修建长度),输出的是需要修的路,不过如果不需要修建就 ...

  2. POJ 2485 Highways【最小生成树最大权——简单模板】

    链接: http://poj.org/problem?id=2485 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#probl ...

  3. Highways(prim & MST)

    Highways Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 23421   Accepted: 10826 Descri ...

  4. poj2485 Highways

    Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public h ...

  5. poj 2485 Highways 最小生成树

    点击打开链接 Highways Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 19004   Accepted: 8815 ...

  6. (poj) 1751 Highways

    Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor ...

  7. Highways poj 2485

    Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public h ...

  8. Highways(求最小生成树的最大边)

    Highways Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Sub ...

  9. POJ2485——Highways

    Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public h ...

随机推荐

  1. jqGrid subGrid配置 如何首次加载动态展开所有的子表格

    有时候需求需要默认加载表格的时候把子表格的数据也显示出来,经过研究相关SubGrids API配置如下: 属性 类型 描述 默认值 subGrid boolean 设置为true启用子表格.如果启用子 ...

  2. AOP报错:Caused by: java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut

    Spring3.x升级4.x时遇到的,JDK版本1.7 aspectj版本问题,1.6.x升级到1.7.x,解决!

  3. 一个ubuntu phper的自我修养(杂记)

    ubuntu使用杂记 1.flatabulous安装使用. flatabulous是一个ubuntu图标主题. 使用它,必须得安装tweak插件. sudo add-apt-repository pp ...

  4. 20161014006 DataGridView Combobox 数据绑定与传值

    //Combobox        private void T_Form_CY_CBD_D_CurrentCellChanged(object sender, EventArgs e)        ...

  5. d20161012

    Milk-run 供应商信息维护 基本信息,电子围栏 外部订单导入[或者录入页面] 订单基本信息,载具信息,物料信息,备注(外协还是华为导入订单,订单内容是否内部投递一样,是否需要导入附加,导入后是否 ...

  6. jvisualvm参数配置

    1.java 命令启动 nohup java -Dlocalcfg=true -Dcom.sun.management.jmxremote.port=9998 -Dcom.sun.management ...

  7. laravel框架总结(十四) -- 数据迁移和数据填充

    一.数据迁移 1.创建一个迁移 1>使用artisan命令make:migration来创建一个新的迁移: php artisan make:migration create_sutdents_ ...

  8. 【前端】Web前端学习笔记【2】

    [2016.02.22至今]的学习笔记. 相关博客: Web前端学习笔记[1] 1. this在 JavaScript 中主要有以下五种使用场景 在全局函数调用中,this 绑定全局对象,浏览器环境全 ...

  9. jquery 设置页面元素不可点击、不可编辑、只读(备忘)

    $("input").attr('readonly', true); $("textarea").attr('readonly', true); $(':rad ...

  10. Cheatsheet: 2016 03.01 ~ 03.31

    JAVA Quick Java 8 or Java 7 Dev Environments With Docker Printing arrays by hacking the JVM Mobile H ...