RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0515

Moo Network

Platinum IV 플래티넘 IV
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Farmer John's \(N\) cows (\(1 \leq N \leq 10^5\)) are spread far apart on his farm
and would like to build a communication network so they can more easily exchange
electronic text messages (all of which of course contain variations of "moo").

The \(i\)th cow is located at a distinct location \((x_i,y_i)\) where
\(0 \leq x_i \leq 10^6\) and \(0 \leq y_i \leq 10\). The cost of building a
communication link between cows \(i\) and \(j\) is the squared distance between
them: \((x_i-x_j)^2 + (y_i-y_j)^2\).

Please calculate the minimum cost required to build a communication network
across which all the cows can communicate. Two cows can communicate if they are
directly connected by a link, or if there is a sequence of links along which
their message can travel.

*Note: the time limit for this problem is 4s, twice the default.*

Problem credits: Brian Dean

제약

SCORING

  • Test cases 2-3 satisfy \(N \le 1000\).
  • Test cases 4-15 satisfy no additional constraints.

Problem credits: Brian Dean

입력 형식

The first line of input contains \(N\), and the next \(N\) lines each describe the
\(x\) and \(y\) coordinates of a cow, all integers.

출력 형식

Please output the minimum cost of a network that will allow all cows to
communicate. Note that this cost might be too large to fit into a 32-bit
integer and may require use of 64-bit integers (e.g., "long long" integers in
C++).

예제 1
입력
10
83 10
77 2
93 4
86 6
49 1
62 7
90 3
63 4
40 10
72 0
출력
660
문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2021-2022 > February > Gold

태그

평가 및 의견

Moo Network

개요
출제자 난이도 Platinum IV 플래티넘 IV 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Moo Network

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