Primal Collection

시간 제한1초메모리 제한2048 MB

요약
1..N+1에서 S를 뺀 값으로 이진 힙을 채우고 바닥에 S를 넣었을 때 정확히 K번 교환되는 배열의 수를 센다.
난이도

어려움10점 중 8점

유형
조합론, 트리, 동적 계획법, 구현
정답자
아직 제출이 없습니다

문제

You are given an array AA, which initially has a size of NN (indexed from 11 to NN) containing distinct integers with values between 11 and N+1N + 1 inclusive. It is known that this array is primal, that is, for any index i>1i > 1, A_iA\_i will always be smaller than A_⌊i/2⌋A\_{\lfloor i/2 \rfloor}.

Denote SS as the value between 11 and N+1N + 1 that does not appear in A_1,A_2,…,A_NA\_1, A\_2, \dots , A\_N. You want to append one new element into AA, namely A_N+1A\_{N+1}, with SS. Then, the following algorithm is executed.

algorithm(A):
  x = N + 1
  counter = 0
  while x > 1:
    if A[x] > A[floor(x / 2)]:
      swap(A[x], A[floor(x / 2)]);
      counter = counter + 1
    x = floor(x / 2)
  return counter

You want to calculate the number of possible values of the initial array AA such that when you append SS to AA and excecute algorithm(A), it will return KK. Note that the initial array AA contains distinct integers with values between 11 and N+1N + 1 inclusive, excluding SS, and array AA has to be primal. As the answer can be very large, find the answer modulo 998,244,353998\\, 244\\, 353.

입력

A single line consisting of three integers NN SS KK (1≤N≤100,0001 ≤ N ≤ 100\\, 000; 1≤S≤N+11 ≤ S ≤ N + 1; 0≤K≤N0 ≤ K ≤ N).

출력

Output a single integer representing the number of possible values of the initial array AA that satisfy the conditions above, modulo 998,244,353998\\, 244\\, 353.

예제3

  1. 예제 1

    입력
    5 3 1
    
    예상 출력
    4
    
  2. 예제 2

    입력
    2 2 1
    
    예상 출력
    0
    
  3. 예제 3

    입력
    7 6 2
    
    예상 출력
    40