Problem K. Keen On Everything But Triangle
时间限制 3000 ms
内存限制 128 MB
$N$ sticks are arranged in a row, and their lengths are $a_1, a_2, ... , a_N$.
There are $Q$ querys. For $i$-th of them, you can only use sticks between $l_i$-th to $r_i$-th. Please output the maximum circumference of all the triangles that you can make with these sticks, or print $-1$ denoting no triangles you can make.
输入数据
输出数据
For each test case, output $Q$ lines, each containing an integer denoting the maximum circumference.
样例输入
复制
5 3
2 5 6 5 2
1 3
2 4
2 5
样例输出
$ Mathjax font initiator $