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

27104번 - Cow Calisthenics 다국어채점 준비 중

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB0000.000%

문제

The cows hate calisthenics (exercises). They do, however, enjoy jogging a little bit. They have surveyed their pasture and have created a list of all the possible paths in the field. Interestingly, the paths are "directed" -- paths can be traversed only in one direction. Sometimes, two different paths connect a pair of points, one path going one way and one path going the other way.

Your job is to help the cows find the shortest "circular route" around which they can jog. A circular route is one which starts and ends at the same location. The length of a route is the sum of the lengths of the paths one must traverse to jog around the route.

Paths in their pasture always connect two points. Each point is named as a positive integer. These points are sequentially numbered, starting at 1. Distances between points are positive integers.

It is guaranteed that at least one "circular route" appears in any supplied cow pasture.

입력

  • Line 1: integer: N, 1 ≤ N ≤ 2000, the number of connections between pairs of points in the pasture; the number of distinct points will never exceed 400
  • Line 2..N+1: N lines specifying a space-separated beginning point, end point, and distance; no distances exceeds 1000

출력

A single line with the integer distance around the shortest possible circuit.

제한

예제 입력 1

4
3 1 5
1 2 4
2 3 3
1 3 44

예제 출력 1

12

힌트

출처

Olympiad > USA Computing Olympiad > 1999-2000 Season > USACO Winter 2000 Contest > Green 3번

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

출처

대학교 대회

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

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