結果

問題 No.1416 ショッピングモール
ユーザー roarisroaris
提出日時 2021-03-05 21:25:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 1,000 ms
コード長 269 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 70,400 KB
最終ジャッジ日時 2024-10-07 00:22:50
合計ジャッジ時間 2,338 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

n = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
k = 0
cap = 1

for Ai in A:
    ans += k*Ai
    cap -= 1
    
    if cap==0:
        k += 1
        cap = 1<<k

print(ans)
0