1488 - Emiya 家今天的饭
时间限制 : 3 秒
内存限制 : 128 MB
输入
第 1 行两个用单个空格隔开的整数 nm。
第 2 行至第 n + 1 行,每行 m 个用单个空格隔开的整数,其中第 i + 1行的 mm 个数依次为 ai1ai2⋯aim。
输出
仅一行一个整数,表示所求方案数对 998244353998244353 取模的结果
样例
输入
2 3 1 0 1 0 1 1
输出
3
提示
2 3 1 0 1 0 1 1
3
3 3 1 2 3 4 5 0 6 0 0
190
5 5 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 1 0 1 0 1 0 1 1 0 1
742
|
【样例 1 解释】
由于在这个样例中,对于每组 <span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">i, j</span><span class="katex-html"><span class="strut" style="vertical-align:-0.19444em;"></span><span class="mord mathnormal" style="font-family:KaTeX_Math;font-style:italic;">i</span><span class="mpunct">,</span><span class="mspace"></span><span class="mord mathnormal" style="font-family:KaTeX_Math;font-style:italic;">j</span></span></span>,Emiya 都最多只会做一道菜,因此我们直接通过给出烹饪方法、主要食材的编号来描述一道菜。
符合要求的方案包括:
<li>
做一道用烹饪方法 1、主要食材 1 的菜和一道用烹饪方法 2、主要食材 2 的菜
</li>
<li>
做一道用烹饪方法 1、主要食材 1 的菜和一道用烹饪方法 2、主要食材 3 的菜
</li>
<li>
做一道用烹饪方法 1、主要食材 3 的菜和一道用烹饪方法 2、主要食材 2 的菜
</li>
因此输出结果为 <span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">3 \mod 998,244,353 = 3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">3</span><span class="mspace allowbreak"></span><span class="mspace"></span><span class="strut" style="vertical-align:-0.19444em;"></span><span class="mord"><span class="mord"><span class="mord mathrm">m</span><span class="mord mathrm">o</span><span class="mord mathrm">d</span></span></span><span class="mspace"></span><span class="mspace"></span><span class="mord">9</span><span class="mord">9</span><span class="mord">8</span><span class="mpunct">,</span><span class="mspace"></span><span class="mord">2</span><span class="mord">4</span><span class="mord">4</span><span class="mpunct">,</span><span class="mspace"></span><span class="mord">3</span><span class="mord">5</span><span class="mord">3</span><span class="mspace"></span><span class="mrel">=</span><span class="mspace"></span><span class="strut" style="vertical-align:0em;"></span><span class="mord">3</span></span></span>。 需要注意的是,所有只包含一道菜的方案都是不符合要求的,因为唯一的主要食材在超过一半的菜中出现,这不满足 Yazid 的要求。
【样例 2 解释】
Emiya 必须至少做 2 道菜。
做 2 道菜的符合要求的方案数为 100。
做 3 道菜的符合要求的方案数为 90。
因此符合要求的方案数为 100 + 90 = 190。
【数据范围】 <br />
<table style="width:669.656px;margin:10px;color:rgba(0,font-family:-apple-system,font-size:16px;background-color:#FFFFFF;">
<tbody>
<tr>
<th style="border:1px solid #DDDDDD;text-align:center;">
测试点编号
</th>
<th style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-weight:normal;font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">n=</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord mathnormal" style="font-family:KaTeX_Math;font-style:italic;">n</span><span class="mspace"></span><span class="mrel">=</span></span></span>
</th>
<th style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-weight:normal;font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">m=</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord mathnormal" style="font-family:KaTeX_Math;font-style:italic;">m</span><span class="mspace"></span><span class="mrel">=</span></span></span>
</th>
<th style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-weight:normal;font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">a_{i,j}<</span><span class="katex-html"><span class="strut" style="vertical-align:-0.286108em;"></span><span class="mord"><span class="mord mathnormal" style="font-family:KaTeX_Math;font-style:italic;">a</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span><span class="pstrut"></span><span class="sizing reset-size6 size3 mtight" style="font-size:0.7em;"><span class="mord mtight"><span class="mord mathnormal mtight" style="font-family:KaTeX_Math;font-style:italic;">i</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="font-family:KaTeX_Math;font-style:italic;">j</span></span></span></span></span><span class="vlist-s" style="vertical-align:bottom;font-size:1px;"></span></span><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span></span></span></span></span></span></span><span class="mspace"></span><span class="mrel"><</span></span></span>
</th>
<th style="border:1px solid #DDDDDD;text-align:center;">
测试点编号
</th>
<th style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-weight:normal;font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">n=</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord mathnormal" style="font-family:KaTeX_Math;font-style:italic;">n</span><span class="mspace"></span><span class="mrel">=</span></span></span>
</th>
<th style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-weight:normal;font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">m=</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord mathnormal" style="font-family:KaTeX_Math;font-style:italic;">m</span><span class="mspace"></span><span class="mrel">=</span></span></span>
</th>
<th style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-weight:normal;font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">a_{i,j}<</span><span class="katex-html"><span class="strut" style="vertical-align:-0.286108em;"></span><span class="mord"><span class="mord mathnormal" style="font-family:KaTeX_Math;font-style:italic;">a</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span><span class="pstrut"></span><span class="sizing reset-size6 size3 mtight" style="font-size:0.7em;"><span class="mord mtight"><span class="mord mathnormal mtight" style="font-family:KaTeX_Math;font-style:italic;">i</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="font-family:KaTeX_Math;font-style:italic;">j</span></span></span></span></span><span class="vlist-s" style="vertical-align:bottom;font-size:1px;"></span></span><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span></span></span></span></span></span></span><span class="mspace"></span><span class="mrel"><</span></span></span>
</th>
</tr>
</tbody>
<tbody>
<tr>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">1</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">7</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">7</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">10</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord">0</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">10^3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span><span class="pstrut"></span><span class="sizing reset-size6 size3 mtight" style="font-size:0.7em;"><span class="mord mtight">3</span></span></span></span></span></span></span></span></span></span>
</td>
</tr>
<tr>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">3</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">8</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">8</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">10</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord">0</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">3</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">10^3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span><span class="pstrut"></span><span class="sizing reset-size6 size3 mtight" style="font-size:0.7em;"><span class="mord mtight">3</span></span></span></span></span></span></span></span></span></span>
</td>
</tr>
<tr>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">3</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">5</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">5</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">9\sim 12</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">9</span><span class="mspace"></span><span class="mrel">∼</span><span class="mspace"></span><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">40</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">4</span><span class="mord">0</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">10^3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span><span class="pstrut"></span><span class="sizing reset-size6 size3 mtight" style="font-size:0.7em;"><span class="mord mtight">3</span></span></span></span></span></span></span></span></span></span>
</td>
</tr>
<tr>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">4</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">4</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">5</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">5</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">3</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">13\sim 16</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord">3</span><span class="mspace"></span><span class="mrel">∼</span><span class="mspace"></span><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord">6</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">40</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">4</span><span class="mord">0</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">3</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">10^3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span><span class="pstrut"></span><span class="sizing reset-size6 size3 mtight" style="font-size:0.7em;"><span class="mord mtight">3</span></span></span></span></span></span></span></span></span></span>
</td>
</tr>
<tr>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">5</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">5</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">10</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord">0</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">17\sim 21</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord">7</span><span class="mspace"></span><span class="mrel">∼</span><span class="mspace"></span><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span><span class="mord">1</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">40</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">4</span><span class="mord">0</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">500</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">5</span><span class="mord">0</span><span class="mord">0</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">10^3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span><span class="pstrut"></span><span class="sizing reset-size6 size3 mtight" style="font-size:0.7em;"><span class="mord mtight">3</span></span></span></span></span></span></span></span></span></span>
</td>
</tr>
<tr>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">6</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">6</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">10</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord">0</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">3</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">3</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">22\sim 25</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span><span class="mord">2</span><span class="mspace"></span><span class="mrel">∼</span><span class="mspace"></span><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span><span class="mord">5</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">100</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord">0</span><span class="mord">0</span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">2\times 10^3</span><span class="katex-html"><span class="strut" style="vertical-align:-0.08333em;"></span><span class="mord">2</span><span class="mspace"></span><span class="mbin">×</span><span class="mspace"></span><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span><span class="pstrut"></span><span class="sizing reset-size6 size3 mtight" style="font-size:0.7em;"><span class="mord mtight">3</span></span></span></span></span></span></span></span></span></span>
</td>
<td style="border:1px solid #DDDDDD;text-align:center;">
<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">998244353</span><span class="katex-html"><span class="strut" style="vertical-align:0em;"></span><span class="mord">9</span><span class="mord">9</span><span class="mord">8</span><span class="mord">2</span><span class="mord">4</span><span class="mord">4</span><span class="mord">3</span><span class="mord">5</span><span class="mord">3</span></span></span>
</td>
</tr>
</tbody>
</table>
对于所有测试点,保证 <span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">1 \leq n \leq 100</span><span class="katex-html"><span class="strut" style="vertical-align:-0.13597em;"></span><span class="mord">1</span><span class="mspace"></span><span class="mrel">≤</span><span class="mspace"></span><span class="strut" style="vertical-align:-0.13597em;"></span><span class="mord mathnormal" style="font-family:KaTeX_Math;font-style:italic;">n</span><span class="mspace"></span><span class="mrel">≤</span><span class="mspace"></span><span class="strut" style="vertical-align:0em;"></span><span class="mord">1</span><span class="mord">0</span><span class="mord">0</span></span></span>,<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">1 \leq m \leq 2000</span><span class="katex-html"><span class="strut" style="vertical-align:-0.13597em;"></span><span class="mord">1</span><span class="mspace"></span><span class="mrel">≤</span><span class="mspace"></span><span class="strut" style="vertical-align:-0.13597em;"></span><span class="mord mathnormal" style="font-family:KaTeX_Math;font-style:italic;">m</span><span class="mspace"></span><span class="mrel">≤</span><span class="mspace"></span><span class="strut" style="vertical-align:0em;"></span><span class="mord">2</span><span class="mord">0</span><span class="mord">0</span><span class="mord">0</span></span></span>,<span class="katex" style="font-size:1.21em;line-height:1.2;font-family:KaTeX_Main,;"><span class="katex-mathml">0 \leq a_{i,j} \lt 998,244,353</span><span class="katex-html"><span class="strut" style="vertical-align:-0.13597em;"></span><span class="mord">0</span><span class="mspace"></span><span class="mrel">≤</span><span class="mspace"></span><span class="strut" style="vertical-align:-0.286108em;"></span><span class="mord"><span class="mord mathnormal" style="font-family:KaTeX_Math;font-style:italic;">a</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span><span class="pstrut"></span><span class="sizing reset-size6 size3 mtight" style="font-size:0.7em;"><span class="mord mtight"><span class="mord mathnormal mtight" style="font-family:KaTeX_Math;font-style:italic;">i</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="font-family:KaTeX_Math;font-style:italic;">j</span></span></span></span></span><span class="vlist-s" style="vertical-align:bottom;font-size:1px;"></span></span><span class="vlist-r"><span class="vlist" style="vertical-align:bottom;"><span></span></span></span></span></span></span><span class="mspace"></span><span class="mrel"><</span><span class="mspace"></span><span class="strut" style="vertical-align:-0.19444em;"></span><span class="mord">9</span><span class="mord">9</span><span class="mord">8</span><span class="mpunct">,</span><span class="mspace"></span><span class="mord">2</span><span class="mord">4</span><span class="mord">4</span><span class="mpunct">,</span><span class="mspace"></span><span class="mord">3</span><span class="mord">5</span><span class="mord">3</span></span></span>。 <br />
来源
noip2019