QOJ.ac

QOJ

时间限制: 2.0 s 内存限制: 512 MB 总分: 100

#77. ドライブ

统计

$N$ 個の都市と $M$ 本の双方向の道路があります。都市には $1$ から $N$ まで、道路には $1$ から $M$ までの番号が付いています。道路 $i$ は都市 $A_i$ と $B_i$ を結び、その長さは $2^i$ です。これらの道路を使って、どの都市からどの都市へも移動できることが保証されています。

Snuke はドライブに出かけたいと考えています。都市 $1$ から出発し、すべての道路を少なくとも一度通って、都市 $1$ に戻りたいと考えています。このような経路の長さの最小値を $10^9+7$ で割った余りを求めてください。

入力

入力は次の形式です。

$$ N\ M\\ A_1\ B_1\\ \vdots\\ A_M\ B_M $$

  • $2\le N\le 400000$
  • $1\le M\le 500000$
  • $1\le A_i,B_i\le N$
  • $A_i\ne B_i$
  • 道路を使って、どの都市からどの都市へも移動できます。
  • 同じ都市の組を結ぶ道路が複数存在することはありません。

出力

Snuke の経路の長さの最小値を $10^9+7$ で割った余りを出力してください。

入出力例

入力 1

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

出力 1

70

入力 2

6 10
4 6
4 5
3 6
5 2
3 2
1 2
3 4
6 1
2 4
1 3

出力 2

2132

注記

problem_77_ffff3b9e74e4b0fe127e0d38289a119d.png

例えば、入出力例 1 における最適な経路の一つは $1\to 2\to 3\to 4\to 2\to 3\to 1$ です。

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.