#P9870. G. Sum of Binomial Coefficients
G. Sum of Binomial Coefficients
G. Sum of Binomial Coefficients
Problem Description
Given an increasing sequence of length . There are queries, each given , calculate:
$$\left(\sum_{i=1}^R \binom{N}{A_i}\right) \bmod {998244353} $$Input
The first line of the input contains two integers () - the length of and the number of queries. The second line contains integers (). Each of the following lines contains two integers (, ).
Output
For each query, print a single integer - the answer of the query, modulo .
Sample Input
6 10
2 4 5 6 8 10
5 2
5 1
4 3
8 5
5 2
5 1
10 6
7 6
6 2
8 6
Sample Output
15
10
7
183
15
10
763
84
30
183
Hint
There is a template for polynomial operations in this link.
Source
2023“钉耙编程”中国大学生算法设计超级联赛(7)