結果
| 問題 |
No.77 レンガのピラミッド
|
| コンテスト | |
| ユーザー |
matsu7874
|
| 提出日時 | 2016-01-08 06:45:46 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 5,000 ms |
| コード長 | 478 bytes |
| コンパイル時間 | 69 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-19 13:06:26 |
| 合計ジャッジ時間 | 1,629 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
min_total = float('inf')
blocks = sum(A)
row = 0
while (row + 1)**2 <= blocks:
row += 1
while 2 * row - 1 > len(A):
A.append(0)
total = 0
for i in range(row):
total += max(0, A[i] - (i + 1))
for i in range(row - 1):
total += max(0, A[2 * row - 2 - i] - (i + 1))
for i in range(2 * row - 1, len(A)):
total += A[i]
min_total = min(min_total, total)
print(min_total)
matsu7874