結果

問題 No.77 レンガのピラミッド
ユーザー rlangevinrlangevin
提出日時 2023-01-16 00:41:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 366 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 76,244 KB
最終ジャッジ日時 2023-08-28 15:22:56
合計ジャッジ時間 3,262 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,052 KB
testcase_01 AC 67 ms
71,096 KB
testcase_02 AC 67 ms
71,228 KB
testcase_03 AC 69 ms
71,176 KB
testcase_04 AC 68 ms
71,180 KB
testcase_05 AC 68 ms
71,176 KB
testcase_06 AC 77 ms
75,804 KB
testcase_07 AC 68 ms
71,172 KB
testcase_08 AC 74 ms
75,848 KB
testcase_09 AC 71 ms
74,916 KB
testcase_10 AC 70 ms
74,824 KB
testcase_11 AC 71 ms
74,908 KB
testcase_12 AC 74 ms
76,244 KB
testcase_13 AC 76 ms
75,828 KB
testcase_14 AC 75 ms
75,988 KB
testcase_15 AC 71 ms
74,856 KB
testcase_16 AC 72 ms
74,888 KB
testcase_17 AC 68 ms
71,180 KB
testcase_18 AC 74 ms
76,060 KB
testcase_19 AC 66 ms
71,368 KB
testcase_20 AC 67 ms
71,284 KB
testcase_21 AC 74 ms
75,924 KB
testcase_22 AC 70 ms
74,904 KB
testcase_23 AC 73 ms
76,032 KB
testcase_24 AC 67 ms
71,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def calc(X):
    v = S
    for i in range(min(len(X), len(A))):
        v -= min(X[i], A[i])
    return v

N = int(input())
A = list(map(int, input().split()))
S = sum(A)
ans = 10 ** 18
for i in range(1, 200):
    L = list(range(1, i + 1))
    for j in range(i - 1, -1, -1):
        L.append(j)
    if sum(L) > S:
        break
    ans = min(ans, calc(L))
print(ans)
0