Universal Cup Judging System

Universal Cup

Time Limit: 6 s Memory Limit: 2048 MB Total points: 100 Difficulty: [show] Hackable ✓
Statistics

Little Cyan Fish lại đang đếm các hoán vị.

Little Cyan Fish có ba số nguyên $n$, $k$ và $S$. Một hoán vị có độ dài $n$ là một dãy số chứa mỗi số nguyên từ $1$ đến $n$ đúng một lần. Little Cyan Fish gọi một chỉ số $i$ là tốt nếu $1 \le i \le n - 2$ và $p_i + p_{i+1} \le S$.

Hãy tìm số lượng hoán vị $p$ có độ dài $n$ mà có đúng $k$ chỉ số tốt. Vì kết quả có thể rất lớn, hãy in ra kết quả theo modulo $998\,244\,353$.

Dữ liệu vào

Có nhiều bộ dữ liệu. Dòng đầu tiên của dữ liệu vào chứa một số nguyên $T$ ($1 \le T \le 1000$), cho biết số lượng bộ dữ liệu.

Đối với mỗi bộ dữ liệu, dòng đầu tiên chứa ba số nguyên $n$, $k$ và $S$ ($1 \le k \le n \le 10^5$, $1 \le S \le 2n - 1$).

Dữ liệu đảm bảo rằng tổng của $n$ trên tất cả các bộ dữ liệu không vượt quá $10^5$.

Dữ liệu ra

Đối với mỗi bộ dữ liệu, hãy in ra một dòng duy nhất chứa một số nguyên duy nhất, cho biết số lượng hoán vị có đúng $k$ chỉ số tốt, theo modulo $998\,244\,353$.

Ví dụ

Dữ liệu vào 1

6
3 1 3
3 1 4
4 1 4
4 2 5
3 2 5
1 1 1

Dữ liệu ra 1

2
4
12
10
0
0

Ghi chú

Trong bộ dữ liệu đầu tiên, hai hoán vị đó là $[1, 2, 3]$ và $[2, 1, 3]$.

Trong bộ dữ liệu thứ hai, bốn hoán vị đó là $[1, 2, 3]$, $[2, 1, 3]$, $[1, 3, 2]$ và $[3, 1, 2]$.

Trong bộ dữ liệu thứ năm và thứ sáu, có ít hơn $k$ chỉ số thỏa mãn $1 \le i \le n - 2$, vì vậy kết quả là $0$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.