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

28192번 - Record Parity 다국어

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

문제

You are given a permutation of length $n$ and an integer $k$.

An element is called a record if it is strictly greater than all the elements before it.

Calculate the sum of $(-1)^{\mathit{len}}$ over all subsequences that have exactly $k$ records. Here $\mathit{len}$ is the number of elements in the subsequence. Since the answer can be large, calculate it modulo 998ドル,244円,353円$.

입력

The first line contains two integers $n$ and $k$ (1ドル \le k \le n \le 10^6$).

The second line contains the permutation $p_1, p_2, \ldots, p_n$.

출력

I'll let you guess this one.

제한

예제 입력 1

5 2
4 1 2 5 3

예제 출력 1

3

예제 입력 2

7 3
1 2 3 4 5 6 7

예제 출력 2

998244318

예제 입력 3

5 5
2 5 4 1 3

예제 출력 3

0

노트

In the second sample all of subsequences of length 3 have exactly 3 records, and none other subsequences have exactly 3 records, so the sum is equal to $(-1)^3 \binom{7}{3} = -35,ドル which is 998ドル,244円,318円$ modulo 998ドル,244円,353円$.

In the third sample none of the subsequences have exactly 5 records, and the sum of empty set is 0.

출처

Camp > Petrozavodsk Programming Camp > Winter 2023 > Day 6: Um_nik mod 998 244 353 Contest C번

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

출처

대학교 대회

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

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