結果
問題 |
No.77 レンガのピラミッド
|
ユーザー |
![]() |
提出日時 | 2015-11-12 22:51:48 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 307 bytes |
コンパイル時間 | 104 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-13 14:32:27 |
合計ジャッジ時間 | 1,213 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 WA * 1 |
other | AC * 2 WA * 18 |
ソースコード
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