CF1159B.Expansion coefficient of the array
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Let's call an array of non-negative integers a1,a2,…,an a k -extension for some non-negative integer k if for all possible pairs of indices 1≤i,j≤n the inequality k⋅∣i−j∣≤min(ai,aj) is satisfied. The expansion coefficient of the array a is the maximal integer k such that the array a is a k -extension. Any array is a 0-expansion, so the expansion coefficient always exists.
You are given an array of non-negative integers a1,a2,…,an . Find its expansion coefficient.
输入格式
The first line contains one positive integer n — the number of elements in the array a ( 2≤n≤300000 ). The next line contains n non-negative integers a1,a2,…,an , separated by spaces ( 0≤ai≤109 ).
输出格式
Print one non-negative integer — expansion coefficient of the array a1,a2,…,an .
输入输出样例
输入#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] is equal to 1 because ∣i−j∣≤min(ai,aj) , because all elements of the array satisfy ai≥3 . On the other hand, this array isn't a 2 -extension, because 6=2⋅∣1−4∣≤min(a1,a4)=5 is false.
In the second test, the expansion coefficient of the array [0,1,2] is equal to 0 because this array is not a 1 -extension, but it is 0 -extension.