时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld
题目描述
You have an array of

elements

.
You need to answer

queries (
each query is independent with others). Every query will give you

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]](https://www.nowcoder.com/equation?tex=%5Bl%2C%20%5C%20r%5D)
after

operations.
输入描述:
The first line contains two positive integers
(
).
The second line contains
integers
(
) .
Each of the next

lines
contains three integers

(

) .
输出描述:
For each test case, output the maximum number.
示例2
输入
复制
5 5
33 15 22 9 7
3 5 5
2 4 7
1 1 6
2 4 10
1 5 5