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?
First line contains an integer n(1≤n≤5*10^5)
Second line contains n integers represent the array a(−10^5≤ai≤10^5)
One line contains an integer represent the answer of the array.
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?
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 .
For each test case output one line containing one integer, indicating the maximum possible score. 继续阅读【STL/思维】King of Karaoke