結果

問題 No.343 手抜き工事のプロ
ユーザー convexineqconvexineq
提出日時 2021-01-14 07:18:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 287 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 93,420 KB
最終ジャッジ日時 2023-08-15 12:08:42
合計ジャッジ時間 3,784 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,188 KB
testcase_01 AC 66 ms
71,608 KB
testcase_02 AC 70 ms
71,280 KB
testcase_03 AC 64 ms
71,120 KB
testcase_04 AC 63 ms
71,128 KB
testcase_05 AC 66 ms
71,280 KB
testcase_06 AC 61 ms
71,304 KB
testcase_07 AC 64 ms
71,280 KB
testcase_08 AC 63 ms
71,324 KB
testcase_09 AC 67 ms
71,360 KB
testcase_10 AC 66 ms
71,508 KB
testcase_11 AC 64 ms
71,292 KB
testcase_12 AC 64 ms
71,464 KB
testcase_13 AC 75 ms
76,592 KB
testcase_14 AC 66 ms
71,320 KB
testcase_15 AC 66 ms
71,504 KB
testcase_16 AC 63 ms
71,320 KB
testcase_17 AC 63 ms
71,344 KB
testcase_18 AC 64 ms
71,292 KB
testcase_19 AC 62 ms
71,364 KB
testcase_20 AC 85 ms
76,656 KB
testcase_21 AC 83 ms
80,836 KB
testcase_22 AC 83 ms
82,464 KB
testcase_23 AC 90 ms
86,224 KB
testcase_24 AC 93 ms
90,800 KB
testcase_25 AC 92 ms
92,848 KB
testcase_26 AC 92 ms
93,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,*x = map(int,open(0).read().split())
L = x[0]
g = cnt = x[0] = 0
ans = n-1
for i in range(n-2,-1,-1):
    cnt += 1
    g += x[i+1]
    if 2*cnt*max(x[i],x[i+1]) < 2*g+L*cnt < 2*cnt*(min(x[i],x[i+1])+L):
        ans -= 1
    if abs(x[i+1]-x[i]) >= L:
        ans = -1
print(max(ans,-1))
0