結果

問題 No.2648 [Cherry 6th Tune D] 一次元の馬
ユーザー moon17moon17
提出日時 2024-02-23 23:41:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 435 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 123,324 KB
最終ジャッジ日時 2024-02-23 23:41:41
合計ジャッジ時間 8,810 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,484 KB
testcase_01 AC 220 ms
77,200 KB
testcase_02 AC 142 ms
76,504 KB
testcase_03 AC 148 ms
76,632 KB
testcase_04 AC 159 ms
99,304 KB
testcase_05 AC 169 ms
115,080 KB
testcase_06 AC 157 ms
110,536 KB
testcase_07 AC 172 ms
118,148 KB
testcase_08 AC 157 ms
108,584 KB
testcase_09 AC 175 ms
119,268 KB
testcase_10 AC 176 ms
116,996 KB
testcase_11 AC 158 ms
113,912 KB
testcase_12 AC 171 ms
123,324 KB
testcase_13 AC 170 ms
118,048 KB
testcase_14 AC 167 ms
119,644 KB
testcase_15 AC 166 ms
119,648 KB
testcase_16 AC 167 ms
119,520 KB
testcase_17 AC 175 ms
119,516 KB
testcase_18 AC 167 ms
119,644 KB
testcase_19 AC 167 ms
119,644 KB
testcase_20 AC 165 ms
119,636 KB
testcase_21 AC 164 ms
119,644 KB
testcase_22 AC 166 ms
119,516 KB
testcase_23 AC 168 ms
119,640 KB
testcase_24 AC 118 ms
103,384 KB
testcase_25 AC 99 ms
89,300 KB
testcase_26 AC 121 ms
103,640 KB
testcase_27 AC 110 ms
102,272 KB
testcase_28 AC 118 ms
103,372 KB
testcase_29 AC 118 ms
100,124 KB
testcase_30 AC 118 ms
103,376 KB
testcase_31 AC 119 ms
103,524 KB
testcase_32 AC 120 ms
103,528 KB
testcase_33 AC 121 ms
103,452 KB
testcase_34 AC 119 ms
103,376 KB
testcase_35 AC 435 ms
77,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import*
for _ in range(int(input())):
  n=int(input())
  *a,=map(int,input().split())
  d=defaultdict(int)
  for i in range(n-1):
    j=i+1
    ni,nj=i+1,j+1
    if a[i]<a[j]:
      d[0]+=1
      continue
#    a[i]+ni*m<a[j]+nj*m
#    a[i]-a[j]<m*(nj-ni)
    m=(a[i]-a[j])//(nj-ni)+1
    d[m]+=1
#  print(d)
  s=0
  ans=-1
  for k in sorted(d):
    s+=d[k]
    if s>=n-1:
      ans=k
      break
  print(ans)
0