2018 牛客网暑期 ACM 多校训练营 (第五场) F.take (树状树组求期望)
传送门: 2018 牛客网暑期 ACM 多校训练营 (第五场) F.take
Problem
Description
Kanade has n boxes , the i-th box has p[i] probability to have an diamond of d[i] size.
At the beginning , Kanade has a diamond of 0 size. She will open the boxes from 1-st to n-th. When she open a box,if there is a diamond in it and it’s bigger than the diamond of her , she will replace it with her diamond.
Now you need to calculate the expect number of replacements.
You only need to output the answer module 998244353.