Problem Statement
Let us consider the problem below for a permutation $P = (P_1, P_2, \ldots, P_N)$ of $(1, 2, \ldots, N)$, and denote the answer by $f(P)$.
We have an
$(N+2)\times (N+2)$grid, where the rows are numbered$0, 1, \ldots, N+1$from top to bottom and the columns are numbered$0, 1, \ldots, N+1$from left to right. Let$(i,j)$denote the square at the$i$-th row and$j$-th column.Consider paths from
$(0, 0)$to$(N+1, N+1)$where we repeatedly move one square right or one square down. However, for each$1\leq i\leq N$, we must not visit the square$(i, P_i)$. How many such paths are there?
You are given a positive integer $N$ and an integer sequence $A = (A_1, A_2, \ldots, A_N)$, where each $A_i$ is $-1$ or an integer between $1$ and $N$ (inclusive).
Consider all permutations $P = (P_1, P_2, \ldots, P_N)$ of $(1, 2, \ldots, N)$ satisfying $A_i\neq -1 \implies P_i = A_i$. Find the sum of $f(P)$ over all such $P$, modulo $998244353$.
Constraints
$1\leq N\leq 200$$A_i = -1$or$1\leq A_i\leq N$.$A_i\neq A_j$if$A_i\neq -1$and$A_j\neq -1$, for$i\neq j$.
Input
Input is given from Standard Input in the following format:
N
A_1 A_2 \ldots A_N
Output
Print the answer.
样例
4
1 -1 4 -1
41
4
4 3 2 1
2
3
-1 -1 -1
48
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。