結果

問題 No.343 手抜き工事のプロ
ユーザー nebukuro09nebukuro09
提出日時 2017-03-24 10:23:47
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 423 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 1,459 ms
コンパイル使用メモリ 77,432 KB
実行使用メモリ 88,256 KB
最終ジャッジ日時 2023-09-20 05:30:22
合計ジャッジ時間 8,877 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
82,400 KB
testcase_01 AC 149 ms
82,504 KB
testcase_02 AC 149 ms
82,528 KB
testcase_03 AC 150 ms
82,632 KB
testcase_04 AC 150 ms
82,108 KB
testcase_05 AC 148 ms
82,424 KB
testcase_06 AC 148 ms
82,108 KB
testcase_07 AC 150 ms
82,436 KB
testcase_08 AC 151 ms
82,596 KB
testcase_09 AC 153 ms
82,436 KB
testcase_10 AC 152 ms
82,484 KB
testcase_11 AC 153 ms
82,524 KB
testcase_12 AC 167 ms
83,080 KB
testcase_13 AC 272 ms
86,264 KB
testcase_14 AC 201 ms
84,144 KB
testcase_15 AC 155 ms
82,832 KB
testcase_16 AC 151 ms
82,576 KB
testcase_17 AC 151 ms
82,540 KB
testcase_18 AC 150 ms
82,524 KB
testcase_19 AC 150 ms
82,612 KB
testcase_20 AC 286 ms
87,356 KB
testcase_21 AC 305 ms
86,324 KB
testcase_22 AC 339 ms
86,528 KB
testcase_23 AC 362 ms
88,232 KB
testcase_24 AC 423 ms
87,596 KB
testcase_25 AC 422 ms
87,832 KB
testcase_26 AC 412 ms
88,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction

N = int(raw_input())
L = int(raw_input())
A = [0]
for i in xrange(N-1):
    A.append(int(raw_input()))

for i in xrange(N-1):
    l1, r1 = A[i], A[i]+L
    l2, r2 = A[i+1], A[i+1]+L
    if r2 <= l1 or r1 <= l2:
        print -1
        exit()

s = 0
ans = 0
for i in xrange(N-1):
    s += Fraction(A[N-i-1] + A[N-i-1] + L, 2)
    ave = Fraction(s, i + 1)
    if (A[N-i-1] < ave < A[N-i-1] + L and
        A[N-i-2] < ave < A[N-i-2] + L):
        pass
    else:
        ans += 1
print ans
0