問題一覧 > 通常問題

No.479 No Need for Vertices

レベル : / 実行時間制限 : 1ケース 1.500秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 165
作問者 : mai
お気に入りにしたユーザー ProblemId : 1357 / 自分の提出
問題文最終更新日: 2025-02-09 23:58:07
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 contest 155 (順位表) の他の問題:

Problem Statement

mai has an undirected graph consisting of $n$ vertices and $m$ edges.

Each vertex of the graph is assigned a distinct non-negative integer from $0$ to $n-1$.
The $j$-th edge is incident to the vertices $a_j$ and $b_j$.

When Maiha was thinking of buying edges from mai, mai made the following proposal.

  • The price of the vertex assigned the non-negative integer $i$ is $2^i$ yen.
  • When you buy a vertex, the edges incident to that vertex come with it as a set.
  • Purchased vertices and edges are removed from mai's graph and are never replenished.
  • You cannot buy edges alone.

Maiha is hungry for edges, so he wants to buy all the edges mai has.
His wealth is infinite, so he can buy a vertex no matter how expensive it is, but he wants to keep the cost as low as possible.

Output the minimum amount Maiha must pay in binary.

Input

$n$ $m$
$a_1$ $b_1$
$a_2$ $b_2$
...
$a_m$ $b_m$

$ 2 \le n \le 100000$
$\lceil n/2 \rceil \le m \le \min \{100000 ,n(n-1) / 2 \}$
$0 \le a_i \lt b_i \le n-1$
No graph containing a vertex that is not incident to any edge is given.
There are no multiple edges (if $i \neq j$, then $a_i \neq a_j$ or $b_i \neq b_j$ holds).

A test case's file name may indicate additional constraints on $n$ and $m$ in the form "s#{number}".
The corresponding additional constraints are as follows.

  • s12 : $n \le 12$ holds
  • s1000 : $n \le 1000$ and $m \le 1000$ hold
  • s100000 : $n$ or $m$ is extremely close to the upper limit of the constraints

Output

Output in binary the minimum amount Maiha must pay to obtain all the edges.
Do not output extra 0s (for example, 0010).

Print a newline at the end.

Sample

Sample 1
Input
4 5
0 1
0 2
0 3
1 2
2 3
Output
101


The figure above shows the graph given from standard input. The number at the center of each vertex is its assigned non-negative integer, and the number at the upper left of each vertex is its price.

Choosing 0 and 2 obtains all the edges and costs only 5 yen. Since 5 is 101 in binary, output 101.

Choosing 0,1,3 also obtains all the edges, but it costs 11 yen.

Sample 2
Input
6 5
0 4
1 2
1 5
2 5
3 4
Output
1111


The graph is not necessarily connected.

Sample 3
Input
10 15
0 1
0 2
0 3
1 4
1 8
2 5
2 9
3 4
3 5
4 6
5 7
6 8
6 7
7 9
8 9
Output
110011101

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