P29965 [洛谷] 「DBOI」Round 1 Unique Class 3
提高
题目描述

Problem Background

HQ is a dedicated logistics teacher at the legendary颜值 High School and also a member of the dormitory management team, responsible for managing the lights.

For him, the most annoying thing is the unruly students from Class 3 who play with the lights in their dormitory and others' dormitories, but he cannot catch the culprits on the spot.

Problem Description

HQ needs to manage the lights in $n$ dormitories. The students in the $i$-th dormitory, due to their legendary颜值, are very picky and can only tolerate light brightness within the range $[l_i, r_i]$. The brightness of each dormitory's light can be adjusted freely within the corresponding tolerable range.

Today, Chen Tianrun decides to become the commander-in-chief and adjust the lights in all dormitories. To prevent being caught by HQ, he must not make the lights in the dormitories too glaring. When the lights in $a$ consecutive dormitories are all brighter than $b$, the lights become glaring. $\color{white}\text{This is not allowed, Commander-in-Chief}$

Therefore, help Chen Tianrun count how many lighting adjustment schemes can satisfy the condition of not being glaring. The answer should be taken modulo $998244353$.

Input Format

The first line contains three positive integers $n, a, b$, as described in the problem.

The following $n$ lines each contain two positive integers, where the $i$-th line's two integers represent $l_i$ and $r_i$.

Output Format

A single line containing an integer, representing the answer modulo $998244353$.

Sample Input and Output

Sample Input #1

3 1 3
3 4
3 3
2 4

Sample Output #1

2

Sample Input #2

5 2 5
2 4
1 6
5 10
1 1
5 6

Sample Output #2

186

Sample Input #3

12 9 66
41 76
33 61
10 25
84 86
20 49
43 59
26 56
44 71
48 79
1 35
27 83
49 76

Sample Output #3

358014651

Notes

Sample Explanation

For Sample #1, only two schemes are possible: $\{3, 3, 2\}$ or $\{3, 3, 3\}$ that satisfy the condition.

For Sample #3, please take the answer modulo $998244353$.

Data Range

This problem uses subtask testing.

For all data, it is guaranteed that $1 \le n \le 2 \cdot 10^5$, $1 \le a \le n+1$, $1 \le b \le 10^9$, $1 \le l_i \le r_i \le 10^9$.

Subtask $n, (a-1) \le$ $l_i, r_i, b \le$ Special Conditions Points
1 5 20 None 10
2 $2 \cdot 10^5$ $10^9$ $a = n+1$ 10
3 $2 \cdot 10^5$ $10^9$ $a = 1$ 10
4 $10^3$ $10^9$ None 30
5 $2 \cdot 10^5$ $10^9$ None 40
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 1 3 3 4 3 3 2 4
样例输出
2