CF1159B.Expansion coefficient of the array

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Let's call an array of non-negative integers a1,a2,,ana_1, a_2, \ldots, a_n a kk -extension for some non-negative integer kk if for all possible pairs of indices 1i,jn1 \leq i, j \leq n the inequality kijmin(ai,aj)k \cdot |i - j| \leq min(a_i, a_j) is satisfied. The expansion coefficient of the array aa is the maximal integer kk such that the array aa is a kk -extension. Any array is a 0-expansion, so the expansion coefficient always exists.

You are given an array of non-negative integers a1,a2,,ana_1, a_2, \ldots, a_n . Find its expansion coefficient.

输入格式

The first line contains one positive integer nn — the number of elements in the array aa ( 2n3000002 \leq n \leq 300\,000 ). The next line contains nn non-negative integers a1,a2,,ana_1, a_2, \ldots, a_n , separated by spaces ( 0ai1090 \leq a_i \leq 10^9 ).

输出格式

Print one non-negative integer — expansion coefficient of the array a1,a2,,ana_1, a_2, \ldots, a_n .

输入输出样例

  • 输入#1

    4
    6 4 5 5
    

    输出#1

    1
  • 输入#2

    3
    0 1 2
    

    输出#2

    0
  • 输入#3

    4
    821 500 479 717
    

    输出#3

    239

说明/提示

In the first test, the expansion coefficient of the array [6,4,5,5][6, 4, 5, 5] is equal to 11 because ijmin(ai,aj)|i-j| \leq min(a_i, a_j) , because all elements of the array satisfy ai3a_i \geq 3 . On the other hand, this array isn't a 22 -extension, because 6=214min(a1,a4)=56 = 2 \cdot |1 - 4| \leq min(a_1, a_4) = 5 is false.

In the second test, the expansion coefficient of the array [0,1,2][0, 1, 2] is equal to 00 because this array is not a 11 -extension, but it is 00 -extension.

首页