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

23167번 - Drunkards 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB833100.000%

문제

He is a positive man in every way, except that he goes to the bar every evening...

One of your friends is a bartender in the city's most famous (and only) bar. There are 2ドル \cdot n + 1$ houses in the city, located along one long road and numbered from 0ドル$ to 2ドル \cdot n$. The bar is located in the house numbered $n$.

The interesting fact is that all drunkards in the city have the same habit. Of course, they leave the bar having a condition not allowing them to go along a way home, so they start to walk without a goal. Namely, every drunkard has an array $a$ in mind, which has length $n$. In the $i$-th second after leaving the bar, the drunkard wants to change his position in the road by $a_i$ ($|a_i| = 1$). If the drunkard was in front of the house $j,ドル he would be in front of the house $j + a_i$ after this change.

However, they are so drunk that each second with probability $\frac{p}{100}$ they are not capable of moving and stay in their current position.

If a drunkard arrives in front of his house, his family members see him and take him home. Possibly, if he lives in the $n$-th house itself, his family members will take him immediately. However, after $n$ seconds, if not taken, a drunkard becomes disappointed and sleeps in the street.

Another drunkard came to the bar. The bartender does not know where he lives, so he just assumes for every house the probability is $\frac{1}{2 \cdot n + 1}$ that the drunkard lives there. Calculate the probability that his family members will take him home modulo 998ドル,244円,353円$.

입력

The first line contains two integers $n$ and $p$ (1ドル \leq n \leq 5000,ドル 0ドル \leq p \leq 100$), which are described in the statement.

The second line contains $n$ integers $a_1, \ldots, a_n$ ($|a_i| = 1$) --- the drunkard's intentions in the $i$-th second.

출력

Output one integer --- the answer modulo 998ドル,244円,353円$.

Formally, let $M = 998,244円,353円$. It can be shown that the answer can be expressed as an irreducible fraction $\frac{p}{q},ドル where $p$ and $q$ are integers and it is guaranteed that $q$ is not divisible by $M$. Output the integer equal to $p \cdot q^{-1} \bmod M$. In other words, output such an integer $x$ that 0ドル \leq x < M$ and $x \cdot q = p \pmod{M}$.

제한

예제 입력 1

2 28
1 1

예제 출력 1

702764025

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2021 > Day 7: Moscow IPT Contest I번

Contest > Open Cup > 2021/2022 Season > Stage 1: Grand Prix of Dolgoprudny I번

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

출처

대학교 대회

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

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