#P9400. Dormitory Light Adjustment
Dormitory Light Adjustment
Dormitory Light Adjustment
HQ is in charge of managing the lights for n dormitories. The students in the i-th dorm only tolerate a light brightness in the range $$[l_i, r_i]$$. For each dorm, the light brightness can be set arbitrarily within its permissible range.
Today, Chen Tianrun decides to act as the supreme commander and adjust the lights for all dormitories. However, to avoid being caught by HQ, he needs to ensure that the lights are not too glaring. In particular, if there exists any contiguous block of a dormitories whose brightness are all strictly greater than $$b$$, then the dormitory lights are considered to be too glaring.
Help Chen Tianrun compute the number of valid ways to adjust the lights so that the dormitories are not glaring. Since the answer can be large, output it modulo $$998244353$$.
inputFormat
The first line contains three integers: n (number of dormitories), a (length of contiguous block to check), and b (brightness threshold).
Then follow n lines, each line contains two integers li and ri, representing the acceptable brightness range for the i-th dormitory.
It is guaranteed that for each dormitory, the brightness can be chosen arbitrarily from the interval $$[l_i, r_i]$$.
outputFormat
Output a single integer, the number of ways to adjust the lights so that no contiguous block of a dormitories all have brightness strictly greater than b, modulo $$998244353$$.
sample
3 2 5
1 6
4 9
3 7
120