結果

問題 No.77 レンガのピラミッド
ユーザー steek79steek79
提出日時 2015-11-12 22:51:48
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 6,652 KB
実行使用メモリ 6,228 KB
最終ジャッジ日時 2023-10-11 15:45:13
合計ジャッジ時間 1,622 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,032 KB
testcase_01 AC 13 ms
6,204 KB
testcase_02 WA -
testcase_03 AC 12 ms
6,032 KB
testcase_04 AC 12 ms
6,044 KB
testcase_05 AC 11 ms
5,920 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 11 ms
5,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

pyramid = range(1, (N/2)+1) + range((N/2)+1, 0, -1)
#print A, pyramid

dif = [ A[i]-pyramid[i] for i in xrange(N)]
#print dif

pos = sum( [d for d in dif if d > 0] )
neg = sum( [d for d in dif if d < 0] ) * (-1)

cnt = min(pos, neg) + abs(pos - neg)
print cnt
0