AtCoder Grand Contest 060
F
Spanning Trees of Interval Graph
AtCoder
未评级
原题
← E→
翻译中…

Problem Statement

翻译中…

You have a simple undirected graph. Each vertex in this graph has an integer interval written on it, and there are $C_{i,j}$ vertices with the interval $[i,j]$ ($1 \leq i \leq j \leq N$). There are no vertices with other intervals.

翻译中…

For any two vertices, there is an undirected edge between them if and only if the written intervals intersect. Here, an interval $[a,b]$ and an interval $[c,d]$ intersect if and only if $\max(a,c) \leq \min(b,d)$.

翻译中…

Find the number of spanning trees of this graph, modulo $998244353$. Here, all vertices are pairwise distinguishable.

翻译中…

Constraints

翻译中…
  • $2 \leq N \leq 400$
  • $1 \leq C_{i,j} \leq 10^4$
  • All numbers in the input are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N
C_{1,1} C_{1,2} \cdots C_{1,N}
C_{2,2} \cdots C_{2,N}
\vdots
C_{N,N}

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
2
1 2
1
Output #1
8
Input #2
3
1 1 1
1 1
1
Output #2
99
Input #3
4
8 3 8 10
1 5 3
1 6
4
Output #3
971555314
Input #4
10
2742 5611 1401 5439 5220 8571 4998 4194 7443 2492
2393 3201 9106 1649 2456 1984 7159 9679 7695
808 4600 2573 7771 5839 9504 4381 3223
5325 2564 456 5050 6963 913 9072
310 1521 9816 6205 2988 3614
4810 2979 2852 9242 6290
7551 7139 7228 699
4869 889 7597
4239 5970
865
Output #4
234850531
题目信息
题号
agc060_f
时间限制
6 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。