Universal Cup Judging System

Universal Cup

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

Little Cyan Fish zählt wieder Permutationen.

Little Cyan Fish hat drei ganze Zahlen $n$, $k$ und $S$. Eine Permutation der Länge $n$ ist eine Folge, die jede ganze Zahl von $1$ bis $n$ genau einmal enthält. Little Cyan Fish nennt einen Index $i$ gut, wenn $1 \le i \le n - 2$ und $p_i + p_{i+1} \le S$ gilt.

Bestimme die Anzahl der Permutationen $p$ der Länge $n$, die genau $k$ gute Indizes haben. Da die Antwort groß sein kann, gib sie modulo $998\,244\,353$ aus.

Eingabe

Es gibt mehrere Testfälle. Die erste Zeile der Eingabe enthält eine einzelne ganze Zahl $T$ ($1 \le T \le 1000$), die die Anzahl der Testfälle angibt.

Für jeden Testfall enthält die erste Zeile drei ganze Zahlen $n$, $k$ und $S$ ($1 \le k \le n \le 10^5$, $1 \le S \le 2n - 1$).

Es wird garantiert, dass die Summe von $n$ über alle Testfälle $10^5$ nicht überschreitet.

Ausgabe

Gib für jeden Testfall eine einzelne Zeile mit einer einzelnen ganzen Zahl aus, die die Anzahl der Permutationen angibt, die genau $k$ gute Indizes haben, modulo $998\,244\,353$.

Beispiele

Eingabe 1

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

Ausgabe 1

2
4
12
10
0
0

Hinweis

Im ersten Testfall sind die beiden Permutationen $[1, 2, 3]$ und $[2, 1, 3]$.

Im zweiten Testfall sind die vier Permutationen $[1, 2, 3]$, $[2, 1, 3]$, $[1, 3, 2]$ und $[3, 1, 2]$.

Im fünften und sechsten Testfall gibt es weniger als $k$ Indizes, die $1 \le i \le n - 2$ erfüllen, daher ist die Antwort $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.