Cactus Determinant
Time limit0.4sMemory limit1024 MB
Given a connected cactus graph with up to 50000 vertices, find the determinant of its adjacency matrix modulo 993244853.
- Level
Hard8 of 10
- Topics
- Graph, Tree, Dynamic programming, DFS
- Solved
- No attempts yet
Problem
A cactus graph is a simple connected undirected graph in which each edge belongs to at most one simple cycle.
The adjacency matrix of an -vertex graph is an integer matrix where is if there is an edge between vertices and , and otherwise.
The determinant of an matrix is defined as
where is the set of all permutations of size , and is the number of pairs such that .
993244853 is a prime number that looks like , but is actually not.
Find the determinant of the adjacency matrix of the given cactus graph, modulo 993244853.
Input
The first line contains and , the number of vertices and edges of the cactus graph. (, )
Each of the next lines contains two distinct integers and , the endpoints of an edge. (, )
The graph is connected, has no loops or multiple edges, and each edge belongs to at most one simple cycle.
Output
Print the determinant of the adjacency matrix of the given cactus graph, modulo 993244853.