結果

問題 No.77 レンガのピラミッド
ユーザー yuki2006yuki2006
提出日時 2014-11-25 21:45:07
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 643 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 7,088 KB
実行使用メモリ 6,112 KB
最終ジャッジ日時 2023-08-31 01:12:59
合計ジャッジ時間 1,856 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 9 ms
6,088 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 10 ms
5,864 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 10 ms
5,964 KB
testcase_08 AC 11 ms
5,888 KB
testcase_09 AC 10 ms
5,956 KB
testcase_10 AC 10 ms
6,048 KB
testcase_11 AC 11 ms
5,936 KB
testcase_12 AC 10 ms
5,940 KB
testcase_13 AC 11 ms
5,964 KB
testcase_14 AC 11 ms
6,000 KB
testcase_15 AC 10 ms
5,944 KB
testcase_16 AC 9 ms
6,052 KB
testcase_17 AC 9 ms
5,940 KB
testcase_18 AC 11 ms
5,956 KB
testcase_19 AC 9 ms
5,940 KB
testcase_20 AC 9 ms
6,052 KB
testcase_21 AC 10 ms
6,096 KB
testcase_22 AC 9 ms
5,940 KB
testcase_23 AC 10 ms
5,864 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(raw_input())
A = map(int, raw_input().split())

total = sum(A)

c = 0
sub_total = 0
mn = total

while sub_total < total:
    diff = 0
    B = [0] * (max(N, c * 2))
    for i, v in enumerate(A):
        B[i] = v

    for i in xrange(c):
        t = B[i] - (i + 1)
        if t > 0:
            diff += t

    for i in xrange(c, c * 2 - 1):
        if i >= len(B):
            print i, len(B), c
        t = B[i] - (2 * c - i - 1)
        if t > 0:
            diff += t

    for i in xrange(c * 2 - 1, N):
        diff += B[i]

    mn = min(diff, mn)

    c += 1
    sub_total += c + (c - 1)

print mn
0