結果

問題 No.77 レンガのピラミッド
ユーザー tnodinotnodino
提出日時 2022-03-08 05:56:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 872 bytes
コンパイル時間 1,303 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 78,536 KB
最終ジャッジ日時 2023-09-30 10:06:31
合計ジャッジ時間 67,369 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,413 ms
78,048 KB
testcase_01 AC 1,867 ms
78,236 KB
testcase_02 AC 1,909 ms
78,044 KB
testcase_03 AC 1,853 ms
78,128 KB
testcase_04 WA -
testcase_05 AC 1,790 ms
78,012 KB
testcase_06 WA -
testcase_07 AC 2,389 ms
77,928 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 AC 1,852 ms
78,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 1<<32
M = 200
N = int(input())
A = list(map(int,input().split()))
ans = INF
for X in range(M):
    for Len in range(1,M,2):
        if X + Len > M:
            break
        P = [0] * M
        cnt = 1
        Mid = Len // 2
        for i in range(Len):
            P[X+i] = cnt
            if i < Mid:
                cnt += 1
            else:
                cnt -= 1
        for Y in range(M):
            if Y + N > M:
                break
            Q = [0] * M
            for i in range(N):
                Q[Y+i] = A[i]
            ret = 0
            cnt = 0
            for i in range(M):
                if P[i] < Q[i]:
                    ret += Q[i] - P[i]
                    cnt += Q[i] - P[i]
                else:
                    cnt -= P[i] - Q[i]
            if cnt < 0:
                ret += INF
            ans = min(ans, ret)
print(ans)
0