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

18499번 - Not Our Problem 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB50101020.833%

문제

Someone (not me!) calls an array of length n consisting of non-negative integers good if and only if ai · ai+1 · min(ai, ai+1) ≤ C holds for all 1 ≤ i < n.

Someone else (we have nothing to do with them!) gives you an array of length n with some blank positions. Calculate the number of ways to fill in the blank positions so that the array is good, or determine that there are infinitely many ways. If the answer is finite, print it modulo 998 244 353.

입력

The first line contains two integers n and C (1 ≤ n ≤ 106, 0 ≤ C ≤ 1018) — the length of the array and the constraint on the product.

The second line contains the array a. Each element is either -1, which means that it needs to be filled, or between 0 and 1018, inclusive.

출력

If the number of ways is infinite, print −1, otherwise print the number of ways modulo 998 244 353.

제한

예제 입력 1

4 100
-1 7 2 -1

예제 출력 1

104

예제 입력 2

4 100
10 -1 -1 1

예제 출력 2

240

예제 입력 3

1 0
-1

예제 출력 3

-1

예제 입력 4

2 10
10 10

예제 출력 4

0

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2020 > Day 8: Almost Algoritmic Contest L번

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

출처

대학교 대회

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

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