結果

問題 No.1416 ショッピングモール
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-02-02 15:05:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 58 ms / 1,000 ms
コード長 327 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 15,868 KB
最終ジャッジ日時 2024-06-29 23:41:11
合計ジャッジ時間 1,730 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
assert(1 <= n <= 5 * 10 ** 4)
a = list(map(int, input().split()))
assert(len(a) == n)
for i in a:
    assert(1 <= i <= 10 ** 3)
capa = [2 ** k for k in range(32)]
a.sort(reverse=True)
floor = 0
ans = 0
for i in a:
    ans += floor * i
    capa[floor] -= 1
    if capa[floor] == 0:
        floor += 1
print(ans)
0