zoukankan      html  css  js  c++  java
  • poj2031-Building a Space Station(最小生成树,kruskal,prime)

    Building a Space Station
    Time Limit: 1000MS   Memory Limit: 30000K
    Total Submissions: 5874   Accepted: 2914

    Description

    You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer program to complete the task. 
    The space station is made up with a number of units, called cells. All cells are sphere-shaped, but their sizes are not necessarily uniform. Each cell is fixed at its predetermined position shortly after the station is successfully put into its orbit. It is quite strange that two cells may be touching each other, or even may be overlapping. In an extreme case, a cell may be totally enclosing another one. I do not know how such arrangements are possible. 

    All the cells must be connected, since crew members should be able to walk from any cell to any other cell. They can walk from a cell A to another cell B, if, (1) A and B are touching each other or overlapping, (2) A and B are connected by a `corridor', or (3) there is a cell C such that walking from A to C, and also from B to C are both possible. Note that the condition (3) should be interpreted transitively. 

    You are expected to design a configuration, namely, which pairs of cells are to be connected with corridors. There is some freedom in the corridor configuration. For example, if there are three cells A, B and C, not touching nor overlapping each other, at least three plans are possible in order to connect all three cells. The first is to build corridors A-B and A-C, the second B-C and B-A, the third C-A and C-B. The cost of building a corridor is proportional to its length. Therefore, you should choose a plan with the shortest total length of the corridors. 

    You can ignore the width of a corridor. A corridor is built between points on two cells' surfaces. It can be made arbitrarily long, but of course the shortest one is chosen. Even if two corridors A-B and C-D intersect in space, they are not considered to form a connection path between (for example) A and C. In other words, you may consider that two corridors never intersect. 

    Input

    The input consists of multiple data sets. Each data set is given in the following format. 


    x1 y1 z1
  • 相关阅读:
    python基础学习-socket套接字的应用
    python基础学习-网络编程(二)
    python基础学习-网络编程(一)
    python基础学习-异常处理
    作业0313
    作业3.11
    作业 3.10
    作业03
    day64——orm单表操作/多表操作
    day63——CBV内部原理、过滤器、标签、inclusion_tag、模版的继承
  • 原文地址:https://www.cnblogs.com/cynchanpin/p/7047739.html
Copyright © 2011-2022 走看看