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

32891번 - Connect Five 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2.5 초 (추가 시간 없음) 1024 MB93342839.437%

문제

In the town of Nattanham, all roads run either north to south, or east to west, and span the entire town. Furthermore, all roads are an equal distance apart. This makes navigating the town extremely easy.

Unfortunately, the roads are quite poor and could do with a fresh layer of asphalt. However, there is not enough money to fix all the roads, so some sections of road need to be given priority.

The mayor has selected five locations in town that he considers to be of great importance: the city hall, the police station, the hospital, the fire department, and of course the mayor's house. Each of these locations is at an intersection.

The mayor wishes that, for each pair of these important locations, it becomes possible to get from one to the other along a shortest path that consists entirely of refurbished road. Within this restriction, the mayor would like to refurbish the smallest amount of road. The intersections do not count toward this amount. Figure C.1 depicts an optimal configuration of refurbished roads.

Figure C.1: Illustration of Sample Input 1, with the locations labelled by their initial letters, and a possible way of refurbishing the minimum number of road segments (22ドル$). The point $(0,0)$ is located at the bottom-left corner of the grid.

입력

The input consists of:

  • Five lines, each with two integers $x$ and $y$ (0ドル \le x, y \le 1000$), the grid coordinates of each of the five important locations.

It is guaranteed that the locations are distinct.

출력

Output the minimum number of road segments that need to be refurbished.

제한

예제 입력 1

8 1
3 4
6 7
10 4
1 2

예제 출력 1

22

예제 입력 2

0 0
0 10
20 0
20 10
3 3

예제 출력 2

70

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2024 C번

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

출처

대학교 대회

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

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