結果

問題 No.77 レンガのピラミッド
ユーザー maimai
提出日時 2017-05-22 07:41:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 99 ms / 5,000 ms
コード長 458 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 75,644 KB
最終ジャッジ日時 2023-10-19 12:55:56
合計ジャッジ時間 3,034 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
72,596 KB
testcase_01 AC 65 ms
70,520 KB
testcase_02 AC 65 ms
72,584 KB
testcase_03 AC 64 ms
70,520 KB
testcase_04 AC 63 ms
70,516 KB
testcase_05 AC 62 ms
70,516 KB
testcase_06 AC 99 ms
75,636 KB
testcase_07 AC 64 ms
72,568 KB
testcase_08 AC 94 ms
75,644 KB
testcase_09 AC 77 ms
75,620 KB
testcase_10 AC 75 ms
75,616 KB
testcase_11 AC 78 ms
75,620 KB
testcase_12 AC 88 ms
75,620 KB
testcase_13 AC 87 ms
75,620 KB
testcase_14 AC 90 ms
75,628 KB
testcase_15 AC 75 ms
75,616 KB
testcase_16 AC 75 ms
75,616 KB
testcase_17 AC 69 ms
73,488 KB
testcase_18 AC 82 ms
75,620 KB
testcase_19 AC 67 ms
72,604 KB
testcase_20 AC 67 ms
72,604 KB
testcase_21 AC 80 ms
75,620 KB
testcase_22 AC 79 ms
75,620 KB
testcase_23 AC 81 ms
75,620 KB
testcase_24 AC 63 ms
70,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
aa = list(map(int,input().split()))

n+=100
aa+=[0]*100

aasum = sum(aa)

result = aasum
for l in range(n-1):
    for r in range(l,n):
        if (r-l)%2: continue
        bb = [0]*n
        for x in range(l,r+1):
            bb[x] = min(x-l,r-x)+1
        if sum(bb) > aasum: continue
        s = 0
        for x in range(n):
            s+= max(0,aa[x]-bb[x]) # 減らす方のみカウント
        result = min(result,s)

print(result)
0