Best Subgraph
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

Cuber QQ is interested in locating the best k-degree subgraph in the graph G=(V(G),E(G)).

A subgraph S is a k-degree subgraph of G, if (i) each vertex has at least k degree in S, (ii) S is connected; and (iii) S is maximal, i.e., any supergraph of S is not a k-degree except S itself.



Then Cuber QQ defines the score of a subgraph S. Before the definition of the score, he firstly defines

  • n(S): the number of vertices in subgraph S, i.e., n(S) = |V (S)|;
  • m(S): the number of edges in subgraph S, i.e., m(S) = |E(S)|;
  • b(S): the number of boundary edges in subgraph S, ;
Then he defines the score of a subgraph is , where M,N,B are given constants.

The higher the score of the subgraph, the better Cuber QQ thinks it is. You are asked to find the best k-degree subgraph in the graph G. If there are many k-degree subgraph with the same score, you should maximize k.

输入描述:

The first line contains two integers n and m (), where n and m are the number of nodes and the number of edges in the graph, respectively.

The second line contains three integers M,N and B (), where the score of a subgraph is .

Each of the next m lines contains two integers u and v (, ), meaning that there is an edge between vertices u and v.

The given graph is an undirected graph without any loops and multiple edges.

输出描述:

The only line contains two space-separated integers, which are k and score of the best k-degree subgraph. You should make sure that k>0 .
示例1

输入

复制
3 3
1 1 2
1 2
2 3
3 1

输出

复制
2 0