結果

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

ソースコード

diff #

n = int(input())
assert(1 <= n <= 5 * 10 ** 4)
a = list(map(int, input().split()))
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