CF1679F Formalism for Formalism

题目描述

### 题意简述 给出正整数 $n$,所有不足 $n$ 位(十进制)的数用前导零补充。 给出 $m$ 组**无序**数对 $(u_i,v_i)$,若一个数字的相邻两位数 $x,y$ 满足 $(x,y)$ 存在于这 $m$ 组数对中,则可以交换 $x,y$ 的位置。若 $A$ 可以通过若干次(包含零次)交换得到 $B$,则认为 $A$ 和 $B$ 是等价的。 求出最大整数 $k$,使得存在一组非负整数 $x_1,x_2,\ldots,x_k(0\leq x_i

输入格式

第一行一个整数 $n(1\leq n\leq 50000)$,含义如题面所述。 第二行一个整数 $m(0\leq m\leq 45)$,表示数对数。 接下来 $m$ 行,每行一个无序数对 $(u_i,v_i)(0\leq u_i,v_i\leq 9)$,保证任意两组数对不相同。

输出格式

输出一个整数 $k$,含义如题面所述。 由于答案可能会很大,你需要输出答案对 $998244353$ 取模的值。

说明/提示

In the first example we can construct a set that contains all integers from $ 0 $ to $ 9 $ . It's easy to see that there are no two equivalent numbers in the set. In the second example there exists a unique pair of equivalent numbers: $ 01 $ and $ 10 $ . We can construct a set that contains all integers from $ 0 $ to $ 99 $ despite number $ 1 $ .