No.1303 Inconvenient Kingdom
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. Show the original
Problem Statement
The Kingdom of yuki has $N$ cities numbered from $1$ to $N$.
There are currently plans to build several roads, each bidirectionally connecting $2$ distinct cities. At this moment, there are no roads connecting the cities.
You are given $M$ road construction plans numbered from $1$ to $M$. The $i$-th road construction plan lists city $u_i$ and city $v_i$.
You may select between $0$ and $M$ distinct road construction plans, inclusive, and perform the following operation for each selected road construction plan.
After finishing the above operations, you may perform the following operation between $0$ and $1$ times, inclusive.
Now, define the inconvenience as follows.
Inconvenience $:= \displaystyle\sum_{i=1}^{N}$(the number of cities not connected to city $i$)
Your goal is to minimize the inconvenience by building roads optimally. Find the minimum achievable inconvenience.
Also, among the "ways of building roads" that achieve the minimum inconvenience, find the number of distinct "ways of building roads" in which the number of roads built is minimum.
Since the number of "ways of building roads" satisfying the conditions can be very large, output it modulo $998244353$.
Note: Definition of connectivity
When one city can be reached from another city by traversing some number of roads, those cities are said to be connected. Also, every city is considered to be connected to itself.Note: Definition of distinct "ways of building roads"
Two "ways of building roads" are defined to be distinct if there exist cities $i$ and $j$ such that a road connecting city $i$ and city $j$ exists in one way of building and no road connecting city $i$ and city $j$ exists in the other way of building. Note that it does not matter by which operation a road was built.
Constraints
- All inputs are integers.
- $2 \le N\le 100$
- $0 \le M\le \frac{N (N - 1)} {2}$
- $1 \le u_i < v_i\le N$
- If $i \neq j$, then $u_i \neq u_j$ or $v_i \neq v_j$ holds.
Input
$N\ M$ $u_1\ v_1$ $u_2\ v_2$ $\vdots$ $u_M\ v_M$
Output
On the first line, output the minimum achievable inconvenience.
On the second line, output the number, modulo $998244353$, of distinct "ways of building roads" in which the number of roads built is minimum among those that achieve the minimum inconvenience.
Sample
Sample 1
Input
3 1 1 2
Output
0 2
An inconvenience of $0$ can be achieved by building $1$ road between city $1$ and city $2$ according to the construction plan, and building $1$ road between city $3$ and either city $1$ or city $2$.
Sample 2
Input
3 0
Output
4 3
For example, if $1$ road is built between city $1$ and city $2$, the inconvenience is $1 + 1 + 2 = 4$, and this is the minimum.
Sample 3
Input
3 2 1 2 1 3
Output
0 3
An inconvenience of $0$ can be achieved.
- Build $1$ road each between city $1$ and city $2$, and between city $1$ and city $3$
- Build $1$ road each between city $1$ and city $2$, and between city $2$ and city $3$
- Build $1$ road each between city $1$ and city $3$, and between city $2$ and city $3$
Sample 4
Input
11 10 5 11 6 11 2 6 2 5 2 11 3 4 3 9 1 10 4 9 7 8
Output
64 288
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
nok0
hamamu
Kite_kuma