結果
問題 | No.343 手抜き工事のプロ |
ユーザー |
|
提出日時 | 2017-03-24 10:23:47 |
言語 | PyPy2 (7.3.15) |
結果 |
AC
|
実行時間 | 349 ms / 2,000 ms |
コード長 | 519 bytes |
コンパイル時間 | 1,226 ms |
コンパイル使用メモリ | 76,584 KB |
実行使用メモリ | 86,172 KB |
最終ジャッジ日時 | 2024-07-06 01:37:25 |
合計ジャッジ時間 | 7,360 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
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