QOJ.ac

QOJ

Time Limit: 0.5 s Memory Limit: 128 MB Total points: 100

#14480. 游走

統計

一个无向连通图,顶点从 $1$ 编号到 $N$,边从 $1$ 编号到 $M$。

小 Z 在该图上进行随机游走,初始时小 Z 在 $1$ 号顶点,每一步小 Z 以相等的概率随机选择当前顶点的某条边,沿着这条边走到下一个顶点,获得等于这条边的编号的分数。当小 Z 到达 $N$ 号顶点时游走结束,总分为所有获得的分数之和。

现在,请你对这 $M$ 条边进行编号,使得小 Z 获得的总分的期望值最小。

输入格式

输入文件第一行是两个整数,分别表示该图的顶点数 $N$ 和边数 $M$。

接下来 $M$ 行每行两个整数 $u,v$ ($1 \le u,v \le N$),表示顶点 $u$ 与顶点 $v$ 之间存在一条边。

输出格式

仅包含一个实数,表示最小的期望值,保留 3 位小数。

样例数据

样例输入

3 3
2 3
1 2
1 3

样例输出

3.333

样例解释

边 (1,2) 编号为 1,边 (1,3) 编号 2,边 (2,3) 编号为 3。

子任务

输入保证 $30\%$ 的数据满足 $N \le 10$,

$100\%$ 的数据满足 $2 \le N \le 500$ 且是一个无向简单连通图。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.