結果
| 問題 |
No.77 レンガのピラミッド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-10-16 01:02:09 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 5,000 ms |
| コード長 | 635 bytes |
| コンパイル時間 | 92 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-10-12 18:38:28 |
| 合計ジャッジ時間 | 1,762 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
ソースコード
N = int(input())
l = list(map(int, input().split()))
zero_l = [0 for i in range(120)]
l = l + zero_l
sum = 0
for l_i in l:
sum += int(l_i)
top = 0
while sum >= top * top:
top += 1
top -= 1
copy_top = top - 1
pyramid = []
for i in range(1, top + 1):
pyramid.append(i)
for i in range(len(pyramid) - 1):
pyramid.append(copy_top)
copy_top -= 1
pyramid = pyramid + [0]
ans = 0
for i in range(len(l) - len(pyramid)):
ck_here = i
ck_ans = 0
for j in range(len(pyramid)):
ck_ans += min(l[ck_here], pyramid[j])
ck_here += 1
if ck_ans > ans:
ans = ck_ans
print(sum - ans)