find the max

Time Limit: 1500ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 1594
64-bit integer IO format: %I64d      Java class name: Main

Description

有一个离散函数f(x),x = {1, 2, ,,,,N},f(x)<2^31。现在要找出2个点i,j, 使得函数在这2点之间的点都在这2点连线下方,且此连线的斜率的绝对值越大越好。

Input

输入包括多个测试实例。每个测试实例包括2行,第一行为一个整数N,2 <= N <= 100000, 然后是N个整数f(x),x=1,2...N,读到文件结束符为止.

Output

对于每个测试实例输出找到的i和j,如果有多个答案,输出字典序最小的一个。

Sample Input

3
1 2 3
3
2 6 4

Sample Output

1 2
1 2

Hint

use scanf to avoid Time Limit Exceeded

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .