Logo
(追記) (追記ここまで)

21272번 - Harsh Comments 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB177637.500%

문제

Posted on a blog are $N+M$ harsh comments. You made $N$ comments, and the $i$-th of them has $A_i$ downvotes. The $i$-th of the other $M$ comments has $B_i$ downvotes.

Mike is going to delete the comments, one by one, by repeating the following operation:

  • Choose a comment randomly and delete it. More precisely, let $x_1,x_2,\ldots,x_k$ be numbers of downvotes the remaining comments have. Then, he will choose the $i$-th of them with the probability $x_i/\left(\sum_{1\leq j \leq k}x_j \right)$ and detele it.

Note that the choices in the operations are independent.

Find the expected number of operations Mike will do until he deletes all of your comments. The answer is a rational number, so print it modulo 998244353ドル$ as usual. We can prove that such representation is always possible under the constraints of this problem.

입력

The first line contains integers $N$ and $M$ (1ドル \leq N,M \leq 100$).

The second line contains integers $A_1,A_2,\ldots,A_N$ (1ドル \leq A_i \leq 100$).

The third line contains integers $B_1,B_2,\ldots,B_M$ (1ドル \leq B_i,ドル $\sum_{1 \leq i \leq N} A_i + \sum_{1 \leq i \leq M} B_i < 998244353$).

출력

Print the answer.

제한

예제 입력 1

1 2
1
1 1

예제 출력 1

2

예제 입력 2

1 1
2
1

예제 출력 2

332748119

예제 입력 3

3 3
2 3 5
7 11 900000000

예제 출력 3

636512475

힌트

출처

Contest > Open Cup > 2020/2021 Season > Stage 14: Grand Prix of Tokyo H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /