| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 11 | 9 | 9 | 90.000% |
You are given two integers $N$ and $M$. You are also given $Q$ constraints in the form $(X_j, Y_j)$.
A sequence $A = (A_1, \dots, A_N)$ of length $N$ is predisposed if and only if:
Find the number of all possible predisposed sequences. As the answer can be quite large, compute it modulo $998244353$.
The first line contains three integers $N$, $M$, and $Q$ ($1 \leq N, M < 998244353$; $1 \leq Q \leq \min(N, 100000)$). Each of the next $Q$ lines contains two integers $X_j$ and $Y_j$ ($1 \leq X_j \leq N$; $0 \leq Y_j < M$; $X_p \neq X_q$ for $p \neq q$) representing a constraint.
Output an integer in a single line representing the number of predisposed sequences modulo $998244353$.
2 3 2 1 0 2 1
1
Explanation of Sample 1: The only predisposed sequence is $A = (2, 1)$.
100000 100000 1 100000 0
373304036