Even
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

You have an array of n elements a_1, \ a_2, \dots , \ a_n.

You need to answer q queries (each query is independent with others). Every query will give you l, \ r, \ k  and it can be completed by the following code: 

a[0] = 0;
bool have_even = 0;
for(int i = l; i <= r; i++)if (a[i] % 2 == 0 && a[i] > 0 ) have_even = 1;
if (have_even)
{
	index = 0;
	for(int i = l; i <= r; i++)
	{
		if (a[index] < a[i] && a[i] % 2 == 0) index = i;
	}
	a[index] /= 2; 
}else
{
	index = l;
	for(int i = l; i <= r; i++)
	{
		if (a[index] < a[i]) index = i;
   	}
	if (a[index] > 0) a[index] = (a[index] - 1) / 2;
}
You want to know the maximum value of interval [l, \ r] after k operations.

输入描述:

The first line contains two positive integers n, \ q(1\le n \le 10^4, 1\le q \le 10^5).

The second line contains n integers a_1, \ a_2, \dots, \ a_n(1 \le a_i \le 10^9) .

Each of the next q lines contains three integers l,\ r,\ k(1\le l\le r \le n, 1 \le k \le 10^9) .

输出描述:

For each test case, output the maximum number.
示例1

输入

复制
3 2
1 2 3
1 2 1
1 3 3

输出

复制
1
1
示例2

输入

复制
5 5
33 15 22 9 7
3 5 5
2 4 7
1 1 6
2 4 10
1 5 5

输出

复制
7
5
0
1
15