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

30370번 - Gacha 101 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB22181780.952%

문제

For each $i = 1, 2, \dots, N,ドル there are $A_i$ balls with $i$ written on them. These are put into a box and mixed up. The string variable $s$ consists of initially $N$ “0”s. Balls are taken out of the box one by one (uniformly at random and independently). When a ball with $i$ written on it is drawn, the $i$-th character of $s$ is changed to “1” (it remains unchanged if it was already “1”). Find the probability, modulo 998ドル,244円,353円,ドル of having a point during this process that $s$ contains “101” as a contiguous substring.

입력

The input consists of a single test case of the following format.

$N$

$A_1$ $A_2$ $\dots$ $A_N$

The first line consists of an integer $N$ between 1ドル$ and 200ドル,000円,ドル inclusive. The second line consists of $N$ positive integers $A_1, A_2, \dots , A_N$. For each $i$ (1ドル \le i \le N$), $A_i$ represents the number of balls $i$ written. And they satisfy $\sum_{1 \le i \le N}{A_i} < 998,244円,353円$.

출력

Output in a line the probability modulo 998ドル,244円,353円$.

제한

예제 입력 1

3
1 2 3

예제 출력 1

465847365

예제 입력 2

10
3 1 4 1 5 9 2 6 5 3

예제 출력 2

488186016

노트

  • How to find the probability modulo 998ドル,244円,353円$
    • It can be proved that the sought probability is always a rational number. Additionally, the constraints of this problem guarantee that if the sought probability is represented as an irreducible fraction $\frac{y}{x},ドル then $x$ is not divisible by 998ドル,244円,353円$. Here, there is a unique 0ドル \le z < 998,244円,353円$ such that $y \equiv xz \pmod{998,244円,353円},ドル so report this $z$.

출처

Contest > ICPC Japanese Alumni Group > JAG Summer Camp > JAG Summer Camp 2023 Day 3 E번

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

출처

대학교 대회

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

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