結果
| 問題 | No.77 レンガのピラミッド |
| コンテスト | |
| ユーザー |
takakin
|
| 提出日時 | 2020-05-16 17:58:24 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 27 ms / 5,000 ms |
| + 425µs | |
| コード長 | 472 bytes |
| 記録 | |
| コンパイル時間 | 100 ms |
| コンパイル使用メモリ | 15,232 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2026-10-13 04:17:20 |
| 合計ジャッジ時間 | 2,239 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 21 |
ソースコード
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
A+=[0 for i in range(n)]
ans=sum(A)
for i in range(n):
pos,neg=0,0
for j in range(2*n):
if j<=i:
if A[j]>=j+1:
pos+=A[j]-(j+1)
else:
neg+=(j+1)-A[j]
elif j<=2*i:
if A[j]>=2*i+1-j:
pos+=A[j]-(2*i+1-j)
else:
neg+=(2*i+1-j)-A[j]
else:
pos+=A[j]
if pos>=neg:
ans=min(ans,pos)
print(ans)
takakin