結果
| 問題 | 
                            No.2648 [Cherry 6th Tune D] 一次元の馬
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-02-23 21:36:04 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 667 ms / 2,000 ms | 
| コード長 | 1,199 bytes | 
| コンパイル時間 | 194 ms | 
| コンパイル使用メモリ | 82,344 KB | 
| 実行使用メモリ | 258,964 KB | 
| 最終ジャッジ日時 | 2025-06-20 02:01:55 | 
| 合計ジャッジ時間 | 13,866 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 38 | 
ソースコード
import sys
inf = float("inf")
input = lambda: sys.stdin.readline().rstrip("\r\n")
print = lambda *args, end="\n", sep=" ": sys.stdout.write(
    sep.join(map(str, args)) + end
)
def II():
    return int(input())
def MII(b=0):
    return map(lambda x: int(x) - b, input().split())
def LII(b=0):
    return list(MII(b))
def find_maximum(check, l, r=None, precision=10**-9):
    if r is None:
        r = 1
        while check(r):
            l = r
            r *= 10
    res = l
    while r - l >= precision:
        mid = [(l + r) / 2, (l + r) // 2][precision == 0]
        if check(mid):
            res = mid
            l = mid + (precision == 0)
        else:
            r = mid - (precision == 0)
    return res
def find_minimun(check, l, r=None, precision=10**-9):
    def chk(x):
        return not check(x)
    res = find_maximum(chk, l, r, precision)
    return res + 1 if precision == 0 else res
def is_sorted(a):
    return all(a[i] < a[i + 1] for i in range(len(a) - 1))
for _ in range(II()):
    n, a = II(), LII()
    def check(m):
        b = [ai + i * m for i, ai in enumerate(a, 1)]
        return is_sorted(b)
    print(find_minimun(check, -1, precision=0))