Universal Cup Judging System

Universal Cup

時間限制: 6 s 記憶體限制: 2048 MB 總分: 100 难度: [顯示] 可 Hack ✓
统计

Little Cyan Fish שוב סופר תמורות.

ל-Little Cyan Fish יש שלושה מספרים שלמים $n$, $k$ ו-$S$. תמורה באורך $n$ היא סדרה המכילה כל מספר שלם מ-$1$ עד $n$ בדיוק פעם אחת. Little Cyan Fish קורא לאינדקס $i$ טוב אם $1 \le i \le n - 2$ ו-$p_i + p_{i+1} \le S$.

מצאו את מספר התמורות $p$ באורך $n$ שיש להן בדיוק $k$ אינדקסים טובים. מאחר שהתשובה עלולה להיות גדולה, הדפיסו אותה מודולו $998\,244\,353$.

קלט

ישנם מספר מקרי בדיקה. השורה הראשונה של הקלט מכילה מספר שלם יחיד $T$ ($1 \le T \le 1000$), המציין את מספר מקרי הבדיקה.

עבור כל מקרה בדיקה, השורה הראשונה מכילה שלושה מספרים שלמים $n$, $k$ ו-$S$ ($1 \le k \le n \le 10^5$, $1 \le S \le 2n - 1$).

מובטח כי סכום ה-$n$ על פני כל מקרי הבדיקה אינו עולה על $10^5$.

פלט

עבור כל מקרה בדיקה, הדפיסו שורה יחידה המכילה מספר שלם יחיד, המציין את מספר התמורות שיש להן בדיוק $k$ אינדקסים טובים, מודולו $998\,244\,353$.

דוגמאות

קלט 1

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

פלט 1

2
4
12
10
0
0

הערה

במקרה הבדיקה הראשון, שתי התמורות הן $[1, 2, 3]$ ו-$[2, 1, 3]$.

במקרה הבדיקה השני, ארבע התמורות הן $[1, 2, 3]$, $[2, 1, 3]$, $[1, 3, 2]$ ו-$[3, 1, 2]$.

במקרי הבדיקה החמישי והשישי, ישנם פחות מ-$k$ אינדקסים המקיימים $1 \le i \le n - 2$, ולכן התשובה היא $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.