|
||||||||||
G. Sum of Binomial CoefficientsTime Limit: 29000/14500 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 80 Accepted Submission(s): 25 Problem Description Given an **increasing** sequence $A$ of length $m$. There are $q$ queries, each given $N, R$, calculate: $$\left(\sum_{i=1}^R \binom{N}{A_i}\right) \bmod {998244353}$$ Input The first line of the input contains two integers $m, q$ ($1 \le m, q < 2 ^ {17}$) - the length of $A$ and the number of queries. The second line contains $m$ integers $A_1, A_2, \dots, A_m$ ($1 \le A_1 < A_2 < \dots < A_m < 2 ^ {17}$). Each of the following $q$ lines contains two integers $N, R$ ($1 \le N \le 10 ^ 9$, $1 \le R \le m$). Output For each query, print a single integer - the answer of the query, modulo $998244353$. Sample Input
Sample Output
Hint There is a template for polynomial operations in [this link](https://paste.ubuntu.com/p/ppX3GhvKYN/). Source | ||||||||||
|