#BZOJ4013. 实验比较
实验比较
题目描述
"Times New Roman"">”
</st1:chmetcnv><span lang="EN-US" style="font-family:宋体;mso-ascii-font-family:"Times New Roman";</p>mso-hansi-font-family:"Times New Roman"">冲突(因为质量序列中
3<1 </span>且1=2,从而3<2,这与主观判断中的 3=2 冲突;同时质量序列中的 3<1 与主观判断中的 3>1 冲突) ,但与主观判断“2 = 1,3 < <st1:chmetcnv unitname="”" sourcevalue="2" hasspace="False" negative="False" numbertype="1" tcsc="0" w:st="on"> 2 <span lang="EN-US" style="font-family:宋体;mso-ascii-font-family:</p>"Times New Roman";mso-hansi-font-family:"Times New Roman"">”
</st1:chmetcnv> </span>不冲突;因此给定主观判断“3>1,3= <st1:chmetcnv unitname="”" sourcevalue="2" hasspace="False" negative="False" numbertype="1" tcsc="0" w:st="on"> 2 <span lang="EN-US" style="font-family:宋体;mso-ascii-font-family:</p>"Times New Roman";mso-hansi-font-family:"Times New Roman"">”
</st1:chmetcnv><span lang="EN-US" style="font-family:宋体;mso-ascii-font-family:"Times New Roman";</p>mso-hansi-font-family:"Times New Roman"">时,</span>1<3=2 </span>和1<2=3 都是合法的质量序列,3<1=2 和1<2<3都是非法的质量序列。由于实验已经做完一段时间了,小D 已经忘了一部分主观实验的数据。对每张图片 i,小 D 都最多只记住了某一张质量不比 i 差的另一张图片 Ki。这些小 D 仍然记得的质量判断一共有 M 条(0 <= M <= N),其中第i 条涉及的图片对为(KXi, Xi),判断要么是KXi < Xi ,要么是KXi = Xi,而且所有的Xi互不相同。小D 打算就以这M 条自己还记得的质量判断作为他的所有主观数据。现在,基于这些主观数据,我们希望你帮小 D 求出这 N 张图片一共有多少个不同的合法质量序列。我们规定:<span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">如果质量序列中出现“</span>x = y<span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">”,那么序列中交换</span> x<span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">和</span>y<span style="font-family:
宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:"Times New Roman"">的位置后仍是同一个序列。</span> <o:p></o:p><span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">因此:</span> 1<2=3=4<5 <span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">和</span>1<4=2=3<5 <span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">是同一个序列,</span> 1 < 2 = 3 <span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">和</span> 1 < 3 = 2 <span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">是同一个序列,而</span>1 < 2 < 3 <span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">与</span>1 < 2 = 3<span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">是不同的序列,</span>1<2<3<span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">和</span>2<1<3 <span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">是不同的序列。</span>由于合法的图片质量序列可能很多, 所以你需要输出答案对10^9 + 7 取模的结果
输入格式
输出格式
输出仅一行,包含一个正整数,表示合法质量序列的数目对 10^9+7取模的结果。
5 4 1 < 2 1 < 3 2 < 4 1 = 5
5
数据范围与约定
不同的合法序列共5个,如下所示: