結果
| 問題 |
No.77 レンガのピラミッド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-20 22:05:43 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 429 bytes |
| コンパイル時間 | 1,359 ms |
| コンパイル使用メモリ | 76,600 KB |
| 実行使用メモリ | 78,876 KB |
| 最終ジャッジ日時 | 2024-09-17 12:22:06 |
| 合計ジャッジ時間 | 4,554 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 4 WA * 16 |
ソースコード
n = input()
a = map(int, raw_input().split())
total = sum(a)
h = 1
ans = float('inf')
while h * h <= total:
w = h * 2 - 1
for j in xrange(n):
low = 0
high = 0
for i in xrange(-111, 111):
y = max(0, (i - j) + h if i <= j else -(i - j) + h)
if 0 <= i and i < n:
if a[i] < y:
low += y - a[i]
elif a[i] > y:
high += a[i] - y
else:
high += y
ans = min(ans, max(low, high))
h += 1
print ans