포럼
문제 ICPC00189

A. Access Points

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
설명

A well-known programming contest is considering a new way to position its teams. For the contest all \(n\) teams have to be assigned some position \((x,y)\) in an infinitely-large gym hall. To keep a good overview of the teams the following strategy is chosen:

All teams have been assigned a unique integer ID in the range \([1,n]\). Any two teams with IDs \(i\) and \(j\), where \(i, must be placed at positions \((x_i,y_i)\), \((x_j,y_j)\), such that \(x_i \le x_j\) and \(y_i \le y_j\).

Unfortunately, someone already assigned the (fixed) internet access point for each team. The access points are quite big and only have one port, so access points for different teams are located at different positions. Every team must be connected to its designated access point by a direct UTP cable. The cost of a UTP cable of length \(\ell\) is \(\ell^2\).

Find a placement for all teams, such that their respective order along both axes is maintained and the total cost of the required UTP cables is minimised. As the judges are not too worried about privacy, they are fine with two (or more) teams being placed at the exact same location or being arbitrarily close together. See Figure for an example.

제약
입력 형식

The input consists of:
- One line with one integer \(n\) (\(1 \le n \le 10^5\)), the number of teams.
- \(n\) lines, the \(i\)th of which contains two integers \(s_i\), \(t_i\) (\(1 \le s_i,t_i \le 10^6\)), the location of the internet access point of team \(i\).

No two access points are at the same position.

출력 형식

Output the minimum total cost of all UTP cables required to connect the teams to their access points in an optimal legal layout.

Your answer should have an absolute or relative error of at most \(10^{-6}\).

예제 1
입력
6
4 1
2 4
3 2
8 3
5 6
2 5
출력
22.5
예제 2
입력
6
11 6
23 7
24 11
24 32
27 38
42 42
출력
0
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NWERC 2018

평가 및 의견

A. Access Points

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

A. Access Points

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8