Inspectors

Time Limit: 1000ms
Memory Limit: 262144KB

This problem will be judged on CodeForcesGym. Original ID: 100641E
64-bit integer IO format: %I64d      Java class name: (Any)

 

Yuri is a rich business owner. His company has factories in many cities across Russia, all of which need regular, monthly inspections. Now Yuri not only has a large portfolio, but a large family as well and he would like to see some of his children start to learn how the business is run. He gures the best way to do this is to have them perform the factory inspections, but he has two concerns. First, he wants each child to be assigned at least two dierent factories { that way they will be able to compare dierent management styles at the factories and get a better idea of what works and what doesn't work. This of course requires them to travel between the factories, which brings up Yuri's second problem: while
he won't be paying his children anything (their weekly allowance is more than adequate), he's worried about the total of all the travel costs, and would like it to be as small as possible. Each child is expected to inspect each of their assigned factories once a month, always ending back at the factory they started at, so to minimize cost he gures he need only assign the factories to minimize the total distance of these factory tours. The more he thinks about this, the more important saving money becomes. He's willing to use as few as only one of his children if that's the cheapest way to inspect all the factories. For example, if Yuri had four factories placed as in the gure on the left below, he could employ just
one child, who could visit each factory for a monthly distance of 40 (assume here that the unlisted distances between factories are all > 10). However, if his factories were located as shown on the right, he would need to employ two children to obtain the monthly minimal distance of 40 (note: he could
use two children to achieve the minimal distance in the rst gure as well).

Since the number of factories changes over time, Yuri would like a program to determine the minimum distance he can expect for any layout of factories.

Input

The input le begins with a line containing a single integer m indicating the number of test cases. Each
test case starts with an integer n indicating the number of factories, where 2 n 100. The next n

CodeForcesGym 100641E Inspectors的更多相关文章

  1. CodeForcesGym 100512D Dynamic LCA

    Dynamic LCA Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForcesGym. ...

  2. CodeForcesGym 100517I IQ Test

    IQ Test Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForcesGym. Orig ...

  3. CodeForcesGym 100517B Bubble Sort

    Bubble Sort Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForcesGym. ...

  4. CodeForcesGym 100517H Hentium Scheduling

    Hentium Scheduling Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForc ...

  5. CodeForcesGym 100524J Jingles of a String

    Jingles of a String Time Limit: 2000ms Memory Limit: 524288KB This problem will be judged on CodeFor ...

  6. CodeForcesGym 100524A Astronomy Problem

    Astronomy Problem Time Limit: 8000ms Memory Limit: 524288KB This problem will be judged on CodeForce ...

  7. CodeForcesGym 100212E Long Dominoes

    Long Dominoes Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged on CodeForcesGym. ...

  8. CodeForcesGym 100753K Upside down primes

    Upside down primes Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForc ...

  9. CodeForcesGym 100753F Divisions

    Divisions Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForcesGym. Or ...

随机推荐

  1. netty 学习记录一

    近期在学习netty相关知识,认为<netty 权威指南>这本书还是挺好的,适合我这样的刚開始学习的人.加上netty本身自带的很多样例,学起来还是挺有兴趣的.简单记录下, 一般serve ...

  2. get post 的区别

    比较 GET 与 POST 还有一个问题就是:form 表单的get post 的默认传输量是多少? 期待评论区来解答!!! 一个获取数据,一个修改数据. 下面的表格比较了两种 HTTP 方法:GET ...

  3. 用SecureCRT在linux系统下载文件

    使用sz命令 说明如下: sz --helpsz version 0.12.20Usage: sz [options] file ...   or: sz [options] -{c|i} COMMA ...

  4. 常用框架(一):spring+springMvc+mybatis+maven

    项目说明: (1) 本例采用 maven web 工程做例子讲解 (2) 利用mybaits 提供的代码生成工具自动生成代码(dao接口,sql mapper映射文件,pojo数据库映射类) (3) ...

  5. JavaScript和Java的区别

    一个是编译型语言(客户端平台必须有仿真器或解释器),一个是解析型语言(不经过编译,直接将文本格式的字符代码发送给浏览器解释执行). 虽然JavaScript与Java有紧密的联系,但却是两个公司开发的 ...

  6. poj 1018(枚举+贪心)

                                                                              通讯系统 We have received an o ...

  7. nyoj--106--背包问题(贪心,水题)

    背包问题 时间限制:3000 ms  |  内存限制:65535 KB 难度:3 描述 现在有很多物品(它们是可以分割的),我们知道它们每个物品的单位重量的价值v和重量w(1<=v,w<= ...

  8. [APIO 2010] 巡逻

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=1912 [算法] 树的直径 [代码] #include<bits/stdc++. ...

  9. Object源码分析(二)

    第五个方法:protected native Object clone() throws CloneNotSupportedException; 源码简介: clone方法首先会判对象是否实现了Clo ...

  10. JXOI2019 退役记

    day0 考前一天在机房和RyeCatcher,还有高一数竞大佬wyt一起颓三国杀,被深深吸引无法自拔,所谓大考大浪,也算是缓解缓解压力 刷刷空间发现好多外地OIer都赶到江科了,萌生出去见一见我江西 ...