結果

問題 No.77 レンガのピラミッド
ユーザー あかりきあかりき
提出日時 2021-02-08 13:18:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 5,000 ms
コード長 425 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 76,084 KB
最終ジャッジ日時 2023-09-19 03:17:14
合計ジャッジ時間 4,526 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
70,956 KB
testcase_01 AC 74 ms
70,936 KB
testcase_02 AC 76 ms
71,284 KB
testcase_03 AC 80 ms
70,984 KB
testcase_04 AC 74 ms
71,288 KB
testcase_05 AC 76 ms
71,192 KB
testcase_06 AC 84 ms
75,880 KB
testcase_07 AC 74 ms
71,204 KB
testcase_08 AC 84 ms
75,712 KB
testcase_09 AC 78 ms
74,812 KB
testcase_10 AC 78 ms
74,444 KB
testcase_11 AC 76 ms
74,564 KB
testcase_12 AC 83 ms
76,084 KB
testcase_13 AC 84 ms
75,808 KB
testcase_14 AC 82 ms
75,528 KB
testcase_15 AC 78 ms
74,800 KB
testcase_16 AC 75 ms
74,812 KB
testcase_17 AC 72 ms
71,196 KB
testcase_18 AC 82 ms
75,968 KB
testcase_19 AC 74 ms
71,196 KB
testcase_20 AC 73 ms
71,036 KB
testcase_21 AC 81 ms
75,724 KB
testcase_22 AC 78 ms
75,036 KB
testcase_23 AC 79 ms
75,472 KB
testcase_24 AC 72 ms
70,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
s=sum(a)
ans=[]
for i in range(1,1000):
  l=[]
  for j in range(i):
    l.append(j+1)
  for j in range(i-2,-1,-1):
    l.append(j+1)
  if sum(l)>s:
    break
  else:
    ct=0
    ctb=0
    for j in range(min(len(l),len(a))):
      if a[j]>l[j]:
        ct+=a[j]-l[j]
    if len(l)<len(a):
      for j in range(len(l),len(a)):
        ct+=a[j]
    ans.append(ct)
print(min(ans))
0