Tom, Jerry and the Unshakable Blueprint
Обмеження: 2 сек., 512 МіБ
Tom has sketched a huge map of secret tunnels and mouse-holes in the house. The map can be represented as a connected undirected graph with \(n\) vertices and \(m\) edges. Each hole is a vertex, and each bidirectional tunnel is an edge. The whole map is connected.
Jerry wants to pick a skeleton blueprint — a spanning tree of the map — to move silently without cycles.
Jerry believes that no matter which spanning tree he chooses, the “traffic profile” of the blueprint — i.e., the multiset of vertex degrees within that spanning tree — is always the same. Tom thinks Jerry is wrong and claims that some graphs admit two spanning trees with different degree multisets.
Your task is to settle their bet.
Вхідні дані
The first line contains two integers \(n\) and \(m\) — the number of vertices and edges.
The next \(m\) lines each contain two integers \(u\) and \(v\) describing an undirected edge \((u, v)\).
Вихідні дані
Print Yes if all spanning trees of the graph have the
same degree multiset, otherwise print No.
Обмеження
\(1 \le n \le 10^5\),
\(1 \le m \le 2 \cdot 10^5\).
\(1 \le u, v \le n\).
The graph is guaranteed to be connected and simple.
Приклади
| Вхідні дані (stdin) | Вихідні дані (stdout) |
|---|---|
| 3 3 1 2 2 3 3 1 | Yes |
| Вхідні дані (stdin) | Вихідні дані (stdout) |
|---|---|
| 4 4 1 2 2 3 3 1 1 4 | No |
| Вхідні дані (stdin) | Вихідні дані (stdout) |
|---|---|
| 10 11 1 2 2 3 3 1 4 5 5 6 6 4 1 4 2 7 3 8 5 9 6 10 | Yes |
Надіслати розв'язок
| Element Type | Створено | Хто | Задача | Компілятор | Результат | Час (сек.) | Пам'ять (МіБ) | № | Дії |
|---|
| Element Type | Створено | Хто | Задача | Компілятор | Результат | Час (сек.) | Пам'ять (МіБ) | № | Дії |
|---|