Logo
(追記) (追記ここまで)

16874번 - Tours de Sales Force 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
15 초 512 MB59151337.143%

문제

The Weight For It company sells home gym equipment to clients in multiple states. Each salesperson in a state is currently in charge of a specific district made up of 3-8 clients. Each salesperson has mapped out the shortest path with which to visit all of their clients in one day (this is known as their sales tour).

Sales have gotten a little light for Weight For It so they’ve decided to cut their sales force in half, reassigning each of the districts of the fired half of the workforce in one state to one in the un-fired half. In order to be fair, each of the un-fired sales persons are assigned exactly one of these districts. After the assignments the remaining salespeople will have to recalculate their minimum sales tours, and as a further cost cutting measure Weight For It would like to assign the districts so that the overall length of all these new sales tours is as small as possible.

For example, Figure I.1 on the left shows the configuration of four districts in one state. Suppose that the salespeople for districts A and B are fired. Then the best reassignment for those districts would be to assign the six clients from district A to the salesperson for district C and the four clients from district B to the salesperson for district D. The resulting shortest sales tours for each of the new districts C' and D' are shown on the right.

Figure I.1: (a) Four districts before firings. (b) Two districts after firings. This example corresponds to Sample Input 1.

입력

Input starts with a positive even integer d (d ≤ 50) indicating the number of districts. Each of the next d lines lists the number and locations of the clients in each of the districts, one district per line starting with district one. Each of these lines starts with an integer n (3 ≤ n ≤ 8) indicating the number of clients in the district, followed by n integer coordinate pairs x y (−10 000 ≤ x, y ≤ 10 000) indicating the locations of the clients. The first d/2 districts listed are those of the fired salespersons. The distance between any two clients is the Euclidean distance and all client locations are distinct.

출력

Display the sum of all the sales tours prior to the firings followed by the sum of all the sales tours after the firings. Your answers should be correct to within an absolute error of 10−2.

제한

예제 입력 1

4
6 0 10 0 20 5 30 10 20 10 10 5 0
4 40 20 40 30 50 20 50 30
4 20 10 30 20 20 20 30 10
3 55 10 45 10 50 0

예제 출력 1

177.082039 179.442719

힌트

출처

ICPC > Regionals > North America > East Central North America Regional > 2018 East Central Regional Contest I번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /