結果

問題 No.77 レンガのピラミッド
ユーザー Mao-betaMao-beta
提出日時 2024-03-04 23:45:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 981 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 63,808 KB
最終ジャッジ日時 2024-03-04 23:45:16
合計ジャッジ時間 2,556 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 49 ms
55,624 KB
testcase_02 WA -
testcase_03 AC 49 ms
55,624 KB
testcase_04 WA -
testcase_05 AC 49 ms
55,624 KB
testcase_06 WA -
testcase_07 AC 50 ms
55,624 KB
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 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
import bisect
from heapq import heapify, heappop, heappush
from collections import deque, defaultdict, Counter
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD99 = 998244353

input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()
SMI = lambda: input().split()
SLI = lambda: list(SMI())
EI = lambda m: [NLI() for _ in range(m)]


def main():
    N = NI()
    A = NLI() + [0]*100
    AS = sum(A)
    ans = 10**9
    for K in range(1, 200, 2):
        P = [0] * K
        for k in range(K):
            P[k] = min(k+1, K-k)
        PS = sum(P)
        if AS < PS:
            break
        over = 0
        for p, a in zip(P, A):
            over += a-p
        ans = min(ans, over + sum(A[K:]))
    print(ans)


if __name__ == "__main__":
    main()
0