問題一覧 > 通常問題

No.95 Alice and Graph

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 50
作問者 : LayCurse
4 ProblemId : 23 / 出題時の順位表 / 自分の提出
問題文最終更新日: 2016-05-03 23:19:03

Description

Alice was given an undirected graph by her mother as a birthday gift.
Then, as usual, Alice is now playing a game with the graph.

The graph has N nodes, numbered from 1 to N, and node k has 2k11 coins.
When the game starts, Alice is in node 1, and there is no coin at node 1, since 2111=0.
Then Alice will be allowed to move at most K times.
At each move, Alice can go to an adjacent node through an edge, and collect the coins at the node.
The question is that what is the maximum number of coins can Alice collect?
Here please note that Alice does not have to go back to node 1.

Input

N M K
U1 V1
U2 V2

UM VM

1N60, denoting the number of the nodes
0MN(N1)/2, denoting the number of the edges
0K15, denoting the number of moves
1Uk,VkN, denoting the edge connecting nodes Uk and Vk, where UkVk
There is at most one edge between any pair of nodes.
Please do NOT assume that the graph is connected.

Output

Output the answer in one line.
One newline-character will be needed at the end of output.
Be careful that the answer may not fit a 32-bit integer type, but it will fit a 64-bit integer type.

Samples

Sample 1
Input
4 3 1
1 2
1 3
1 4
Output
7

Alice can move node 2 or node 3 or node 4. Here node 4 has 2411=7 coins.

Sample 2
Input
5 4 4
3 4
4 1
1 5
5 2
Output
25

The graph is as follows: 34152.
The optimal sequence of moves of Alice is 15143.
Thus the answer will be (2511)+(2411)+(2311)=15+7+3=25.

Sample 3
Input
20 21 15
8 16
2 11
7 5
6 8
17 8
4 17
15 20
13 14
5 11
2 12
19 18
11 18
10 19
3 7
9 8
20 2
3 19
17 15
3 2
17 11
1 9
Output
1036150

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