結果

問題 No.77 レンガのピラミッド
ユーザー yuki2006yuki2006
提出日時 2014-11-25 21:35:34
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 732 ms
コンパイル使用メモリ 6,704 KB
実行使用メモリ 6,116 KB
最終ジャッジ日時 2023-08-31 01:12:17
合計ジャッジ時間 2,035 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 11 ms
5,956 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 11 ms
5,936 KB
testcase_05 WA -
testcase_06 RE -
testcase_07 AC 11 ms
5,880 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
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

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

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

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

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

print mn
0