結果

問題 No.2648 [Cherry 6th Tune D] 一次元の馬
ユーザー ゼットゼット
提出日時 2024-02-23 21:28:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 353 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 107,176 KB
最終ジャッジ日時 2024-02-23 21:28:46
合計ジャッジ時間 5,926 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 160 ms
76,604 KB
testcase_02 AC 94 ms
76,092 KB
testcase_03 AC 96 ms
76,120 KB
testcase_04 AC 99 ms
97,460 KB
testcase_05 AC 109 ms
104,084 KB
testcase_06 AC 91 ms
91,760 KB
testcase_07 AC 99 ms
104,988 KB
testcase_08 AC 91 ms
92,972 KB
testcase_09 AC 100 ms
107,176 KB
testcase_10 AC 98 ms
104,120 KB
testcase_11 AC 104 ms
99,616 KB
testcase_12 AC 100 ms
98,900 KB
testcase_13 AC 103 ms
105,092 KB
testcase_14 AC 98 ms
101,728 KB
testcase_15 AC 99 ms
101,728 KB
testcase_16 AC 109 ms
101,728 KB
testcase_17 AC 97 ms
101,600 KB
testcase_18 AC 98 ms
101,728 KB
testcase_19 AC 101 ms
101,728 KB
testcase_20 AC 100 ms
101,728 KB
testcase_21 AC 98 ms
101,728 KB
testcase_22 AC 107 ms
101,728 KB
testcase_23 AC 99 ms
101,728 KB
testcase_24 AC 99 ms
101,728 KB
testcase_25 AC 84 ms
88,480 KB
testcase_26 AC 106 ms
101,728 KB
testcase_27 AC 94 ms
96,808 KB
testcase_28 AC 95 ms
101,672 KB
testcase_29 AC 94 ms
105,188 KB
testcase_30 AC 95 ms
101,672 KB
testcase_31 AC 95 ms
101,672 KB
testcase_32 AC 95 ms
101,672 KB
testcase_33 AC 98 ms
107,020 KB
testcase_34 AC 96 ms
101,672 KB
testcase_35 AC 353 ms
76,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Q=int(input())
for _ in range(Q):
  N=int(input())
  A=list(map(int,input().split()))
  l=0
  for i in range(1,N):
    y=A[i-1]-A[i]+1
    if y>0:
      l=max(l,y)
  B=[0]*N
  for i in range(N):
    B[i]=A[i]+l*(i+1)
  ans=True
  for i in range(1,N):
    if B[i]<=B[i-1]:
      ans=False
      break
  if ans==True:
    print(l)
  else:
    print(-1)
0