結果
問題 |
No.343 手抜き工事のプロ
|
ユーザー |
|
提出日時 | 2016-02-13 00:32:00 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 228 ms / 2,000 ms |
コード長 | 926 bytes |
コンパイル時間 | 121 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 13,480 KB |
最終ジャッジ日時 | 2024-09-22 05:10:27 |
合計ジャッジ時間 | 2,210 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
#!/usr/bin/env python #coding:utf8 def read(): N = int(raw_input()) L = int(raw_input()) xList = [] xList.append(0) for i in range(N - 1): xList.append(int(raw_input())) return L, xList def work((L, xList)): xList = xList[::-1] ans = 0 total = 0 for i in range(len(xList)): if i > 0: # not (xList[i ] - L / 2 < total / i < xList[i ] + L / 2) or # not (xList[i + 1] - L / 2 < total / i < xList[i + 1] + L / 2) if not (i * (2 * xList[i ] - L) < 2 * total < i * (2 * xList[i ] + L)) or \ not (i * (2 * xList[i - 1] - L) < 2 * total < i * (2 * xList[i - 1] + L)): ans += 1 if abs(xList[i - 1] - xList[i]) >= L: print -1 return total += xList[i] print ans if __name__ == "__main__": work(read())