链接:
https://ac.nowcoder.com/acm/contest/57361/A
来源:牛客网
Daniel and sszcdjr are playing a game. The game is played on a sequence
aaa of length
nnn. Initially, all elements in
aaa are equal to
000. They will do the following operations
mmm times on it:
* Daniel selects one segment
[li,ri][l_i,r_i][li,ri] (
1≤l≤r≤n1\le l\le r\le n1≤l≤r≤n);
* Then, sszcdjr chooses a real number
xxx such that
0≤x≤10\le x\le 10≤x≤1 \bf{uniformly at random};
* For all
li≤j≤ril_i\le j\le r_ili≤j≤ri, set
aj:=aj+xa_j:=a_j+xaj:=aj+x.
However, sszcdjr thinks it is unfair for him. So he adds a rule: for any two segments
[li,ri][l_i,r_i][li,ri] and
[lj,rj][l_j,r_j][lj,rj] (
i≠ji\ne ji=j), one of the following condition must holds:
* The two segments are completely disjoint. More formally, either
li≤ri<lj≤rjl_i\le r_i<l_j\le r_jli≤ri<lj≤rj or
lj≤rj<li≤ril_j\le r_j<l_i\le r_ilj≤rj<li≤ri;
* One of the two segments are inside another. More formally, either
li≤lj≤rj≤ril_i\le l_j\le r_j\le r_ili≤lj≤rj≤ri or
lj≤li≤ri≤rjl_j\le l_i\le r_i\le r_jlj≤li≤ri≤rj.
Note that two segments can be exactly the same.
Let
sss be the maximum number in
aaa after the operations. zxx is crazy about probabilities, so he gives you
ttt queries. In each query, he gives you two numbers
PPP,
QQQ, and asks you the probability that
P≤s≤QP\le s\le QP≤s≤Q. You just need to tell him the answer modulo
998 244 353998~244~353998 244 353.