问题 G: Sum of Binomial Coefficients

内存限制:512 MB 时间限制:15 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

Given an increasing sequence A of length m.

There are q queries, each given N, R, calculate:





输入格式

The first line of the input contains two integers m, q (1m,q<2^17) - the length of A and the number of queries.

The second line contains m integers A1,A2,,Am (1A1<A2<<Am<2^17).

Each of the following q lines contains two integers N, R(1N10^9, 1Rm).

 

输出格式

For each query, print a single integer - the answer of the query, modulo 998244353.

输入样例 复制

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

输出样例 复制

15
10
7
183
15
10
763
84
30
183

分类标签