logo AlgoBeat OnlineJudge
登录 注册

#206057. [ICPC 2015 WF] Qanat

内存限制:1024 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

A qanat is an irrigation system widely used to deliver water in hot, arid climates. The technology was originally developed by Persians over 2000 years ago. In Morocco, qanats are known as khettara and are still used today in the southern part of the country.

The basic feature of a qanat is an essentially horizontal channel that brings water from an underground water source to an outlet near a civilization. There is also a shaft known as a mother well that rises vertically from the underground water source to the surface of a mountain or hill. Creating such a system is extremely expensive, and was especially so in ancient times, since all of the materials excavated from the channel and mother well must be carried above ground, either through the channel outlet or the top of the mother well. To aid in the construction, there are often one or more additional vertical shafts placed at strategic locations above the underground channel. Although these shafts must also be excavated, they provide a means for lifting additional dirt from the horizontal channel as illustrated in Figure 1.

Figure 1: An illustration of a qanat.

For this problem, model the cross-section of a qanat as shown in Figure 2, with the channel outlet at , the water source at , and the top of the mother well at with . The surface of the mountain extends along a straight line from to .

Figure 2: A simplified model of a qanat cross-section.

Every qanat must have a vertical mother well from the water source to the mountain surface above, along with additional vertical shafts. The channel and all shafts are modeled as line segments. Your goal is to determine the placement for those additional shafts so as to minimize the overall excavation cost. This cost is equal to the sum of the distances that each piece of excavated dirt must be transported to reach the surface (using any combination of horizontal and vertical movement). For example, the cost of excavating a continuous section of dirt starting from the surface and going along a path of length  (possibly including turns) is .

输入格式

The input consists of a single line containing three integers (), (), and  (). The value is the horizontal distance from the water source to the qanat outlet. The value is the vertical distance from the water source to the mountain surface. The value is the number of vertical shafts that must be used in addition to the mother well.

输出格式

First, display the minimum overall excavation cost. Next, display the -coordinates, in increasing order, for optimally placed vertical shafts. If , display only the first -coordinates. Answers within an absolute or relative error of will be accepted. You may assume that there is a unique solution. No test case will result in a shaft within units from the outlet of the qanat channel or from another shaft.

样例

样例输入 1

8 4 1

样例输出 1

31.500000
3.000000

样例输入 2

195 65 2

样例输出 2

12220.000000
48.000000
108.000000

样例输入 3

10000 1 1000

样例输出 3

30141.885677
9.956721
19.913443
29.870164
39.826887
49.783610
59.740334
69.697060
79.653786
89.610515
99.567245

数据范围与提示

Time limit: 2000 ms, Memory limit: 1048576 kB.

International Collegiate Programming Contest (ACM-ICPC) World Finals 2015