QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22792. 乳牛體操

Statistics

乳牛討厭體操(鍛鍊),卻有點喜歡慢跑。牠們勘查牧場,列出全部可能道路。有趣的是道路「有向」,只能沿一個方向走。有時兩點有兩條不同道路,分別朝相反方向。

幫助乳牛找出可慢跑的最短「環形路線」。此路線從同一地點出發並結束,長度是繞一圈經過各道路長度的總和。

牧場道路總連接兩點。點以正整數命名,從 1 起連續編號;距離為正整數。

保證每個給定牧場至少有一條「環形路線」。

輸入格式

  • 第 $1$ 行:$N$($1 \le N \le 2000$),有向道路數;至多 400 個不同點。
  • 第 $2..N+1$ 行:每行一條道路的起點、終點、距離(至多 1000)。

輸出格式

一行一個整數,最短可能環形路線的距離。

範例

輸入格式 1

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

輸出格式 1

12

題目作者:Hal Burch 與 Russ Cox

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.