Describe

Alice has a magic array. She suggests that the value of a interval is equal to the sum of the values in the interval, multiplied by the smallest value in the interval.

Now she is planning to find the max value of the intervals in her array. Can you help her?

Input

First line contains an integer n(1≤n≤5*10^5)

Second line contains

Output

One line contains an integer represent the answer of the array.

5

1 2 3 4 5

36

## 【STL/思维】King of Karaoke

It’s Karaoke time! DreamGrid is performing the song Powder Snow in the game King of Karaoke. The song performed by DreamGrid can be considered as an integer sequence , and the standard version of the song can be considered as another integer sequence . The score is the number of integers satisfying and .

As a good tuner, DreamGrid can choose an integer (can be positive, 0, or negative) as his tune and add to every element in . Can you help him maximize his score by choosing a proper tune?

Input
There are multiple test cases. The first line of the input contains an integer (about 100), indicating the number of test cases. For each test case:

The first line contains one integer (), indicating the length of the sequences and .

The second line contains integers (), indicating the song performed by DreamGrid.

The third line contains integers (), indicating the standard version of the song.

It’s guaranteed that at most 5 test cases have .

Output
For each test case output one line containing one integer, indicating the maximum possible score. 继续阅读【STL/思维】King of Karaoke

## 【set去重】矩阵中不重复的数

…….

(a^b表示a的b次方）

2^2=4, 2^3=8, 2^4=16, 2^5=32
3^2=9, 3^3=27, 3^4=81, 3^5=243
4^2=16, 4^3=64, 4^4=256, 4^5=1024
5^2=25, 5^3=125, 5^4=625, 5^5=3125

2^2=4, 2^3=8, 2^4=16, 2^5=32
3^2=9, 3^3=27, 3^4=81, 3^5=243
4^2=16, 4^3=64, 4^4=256, 4^5=1024
m = 4, n = 3, a = 2, b = 2。其中2^4与4^2是重复的元素。 继续阅读【set去重】矩阵中不重复的数

## 【STL二分、打表】因子只包含2 3 5的数

51nod P1010
K的因子中只包含2 3 5。满足条件的前10个数是：2,3,4,5,6,8,9,10,12,15。