結果

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

ソースコード

diff #

N = int(input())
pow2 = 1
ans = 0
A = list(map(int, input().split()))
A.sort(reverse = True)
x = 0
f = 0
while x < N:
    for i in range(pow2):
        ans += f * A[x]
        x += 1
        if x >= N:
            break
    f += 1
    pow2 *= 2
print(ans)
0