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

15535번 - Share the Ruins Preservation 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB41191745.946%

문제

Two organizations International Community for Preservation of Constructions (ICPC) and Japanese Archaeologist Group (JAG) engage in ruins preservation. Recently, many ruins were found in a certain zone. The two organizations decided to share the preservation of the ruins by assigning some of the ruins to ICPC and the other ruins to JAG.

Now, ICPC and JAG make a rule for assignment as follows:

  1. Draw a vertical straight line from the north to the south, avoiding to intersect ruins.
  2. Ruins located to the west of the line are preserved by ICPC. On the other hand, ruins located to the east of the line are preserved by JAG. (It is possible that no ruins are located to the east/west of the line; in this case, ICPC/JAG will preserve no ruins.)

A problem is where to draw a straight line. For each organization, the way to preserve its assigned ruins is to make exactly one fence such that all the assigned ruins are in the region surrounded by the fence. Furthermore, they should minimize the length of such a fence for their budget. If the surrounded areas are vast, expensive costs will be needed to maintain the inside of areas. Therefore, they want to minimize the total preservation cost, i.e. the sum of the areas surrounded by two fences. Your task is to write a program computing the minimum sum of the areas surrounded by two fences, yielded by drawing an appropriate straight line.

입력

The input consists of a single test case.

N
x1 y1
...
xN yN

The first line contains an integer N (1 ≤ N ≤ 100,000), which is the number of founded ruins. The following N lines represent the location of the ruins. The i-th line of them consists of two integers xi and yi, which indicate the location of the i-th ruin is xi east and yi north from a certain location in the zone. You can assume the following things for the ruins:

  • −109 ≤ xi, yi ≤ 109
  • You can ignore the sizes of ruins. That is, you can assume ruins are points.
  • No pair of ruins has the same location.

출력

Print the minimum total preservation cost yielded by drawing an appropriate straight line. You should round off the cost to the nearest integer.

제한

예제 입력 1

8
-10 0
-10 5
-5 5
-5 0
10 0
10 -5
5 -5
5 0

예제 출력 1

50

예제 입력 2

5
0 0
0 1
0 2
1 0
1 1

예제 출력 2

0

예제 입력 3

6
1 5
1 6
0 5
0 -5
-1 -5
-1 -6

예제 출력 3

6

예제 입력 4

10
2 5
4 6
9 5
8 8
1 3
6 4
5 9
7 3
7 7
3 9

예제 출력 4

17

힌트

출처

Contest > ICPC Japanese Alumni Group > JAG Practice Contest for ICPC Asia Regional > JAG Practice Contest for ACM-ICPC Asia Regional 2016 G번

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

출처

대학교 대회

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

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