問題一覧 > ネタ問題

No.8078 Very Simple Traveling Salesman Problem

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 189
作問者 : NatsubiSogan / テスター : aspi
お気に入りにしたユーザー ProblemId : 6063 / 自分の提出
問題文最終更新日: 2021-04-06 11:08:27
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder April Fool Contest 2021 (順位表) の他の問題:

Problem Statement

You are given a simple connected undirected graph with $N$ vertices and $M$ edges, where the vertices are numbered from $1$ to $N$ and the edges are numbered from $1$ to $M$. Edge $i$ connects vertices $u_i$ and $v_i$ bidirectionally with weight $w_i$.

Consider tours that start from some vertex, pass through every vertex exactly $1$ time, and return to the starting point. Find the weight of such a tour whose weight is minimum.

It can be shown that at least $1$ such tour exists under the constraints of this problem.

Input

$N\ M$
$u_1\ v_1\ w_1$
$u_2\ v_2\ w_2$
$\vdots$
$u_M\ v_M\ w_M$

  • All inputs are integers.
  • The given graph is simple and connected.
  • $2 \leq N \leq 500$
  • $M=\displaystyle \frac{N(N-1)}{2}$
  • $1 \leq u_i,v_i \leq N$
  • $w_i=1$

Output

Output on $1$ line the minimum weight of a tour satisfying the conditions in the problem statement.

Print a newline at the end.

Sample

Sample 1
Input
2 1
1 2 1
Output
2

The only option is to go there and come back.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。