Cactus Determinant

선인장 그래프의 인접 행렬 행렬식을 소수 993244853으로 나눈 나머지를 구한다.

어려움8수학그래프조합론동적 계획법아직 제출이 없습니다시간 제한0.4초메모리 제한1024 MB

문제

A Cactus graph is a simple connected undirected graph where each edge lies in at most one simple cycle.

An adjacency matrix of a NN-vertex graph is a N×NN\times N integer matrix, where A_i,jA\_{i, j} is 11 if there exists an edge connecting vertex ii and jj, and 00 otherwise.

The Determinant of a N×NN\times N matrix is defined as _pP(N)(1)inv(p)(_i=1nA_i,p_i)\sum\_{p \in P(N)}{(-1)^{inv(p)}(\prod\_{i=1}^{n}{A\_{i, p\_i}})} , where P(N)P(N) is the set of all permutations of size-NN, and inv(p)inv(p) is the number of pairs 1i<jN1 \le i < j \le N such that p_i>p_jp\_i > p\_j.

993244853 is a prime number that looks like 998244353=119×223+1998244353 = 119 \times 2^{23} + 1, but is actually not.

This problem asks you to calculate the determinant of an adjacency matrix of given cactus graph mod 993244853993244853.

입력

The first line contains N,MN, M, denoting the number of vertices and edges of the cactus graph. (1N50000,0M2500001 \le N \le 50000, 0 \le M \le 250000)

In the next MM lines, two distinct integers s,es, e denoting each endpoint of the edges are given. (1s,eN,se1 \le s, e \le N, s \neq e).

It is guaranteed that the graph is connected, it does not contain loops or multiple edges, and every edge belongs to at most one simple cycle.

출력

Print the determinant of an adjacency matrix of given cactus graph mod 993244853.