QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 2048 MB Points totaux : 100 Difficulté: [afficher]

#18231. NFLSPC

Statistiques

Welcome to APLSPC!

As everyone knows, contest data is prepared on the night before the contest.

Unfortunately, while checking the data for a graph theory problem before NFLSPC, the Emperor discovered that the first two lines of all data files had been deleted by the evil Little P.

Looking at the incomplete data, the Emperor suddenly wondered how many ways there are to complete the first two lines such that the data is valid, modulo $998244353$.

Since the Emperor is the Emperor, he has given you the input file to solve this problem.

The Emperor, in his mercy, guarantees that at least one valid completion exists.

Given several lines of data, find how many input datasets exist such that:

  • The dataset with the first two lines removed is equal to the given lines.
  • The dataset fully satisfies the input format of the original problem.

The input format of the original problem is as follows:

The first line contains a positive integer $T$, followed by $T$ test cases.

The first line of each test case contains two positive integers $n, m$.

The next $m$ lines each contain two positive integers $u, v\ (1\leq u, v\leq n)$, describing a graph.

The graph may be disconnected and may contain multiple edges and self-loops.

The constraints of the original problem are:

$1\le T \leq 2\times 10^5 $;

$1\le n, m \leq 2\times 10^5$.

Input

Several lines (not exceeding $2\times 10^5$ lines), each containing two positive integers.

Output

A single line containing a positive integer representing the number of ways to complete the data, modulo $998244353$.

Examples

Input 1

2 1
1 1

Output 1

199999

Data Range

For all data: all input numbers are in the range $[1, 2\times 10^5]$, and the input contains no more than $2\times 10^5$ lines.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.