Universal Cup Judging System

Universal Cup

実行時間制限: 6 s メモリ制限: 2048 MB 満点: 100 難易度: [表示] ハック可能 ✓
統計

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]$

ในกรณีทดสอบที่ห้าและหก มีดัชนีที่สอดคล้องกับเงื่อนไข $1 \le i \le n - 2$ น้อยกว่า $k$ ตัว ดังนั้นคำตอบจึงเป็น $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.