結果
| 問題 | No.1416 ショッピングモール | 
| コンテスト | |
| ユーザー |  nephrologist | 
| 提出日時 | 2021-03-05 21:34:32 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 57 ms / 1,000 ms | 
| コード長 | 278 bytes | 
| コンパイル時間 | 204 ms | 
| コンパイル使用メモリ | 81,664 KB | 
| 実行使用メモリ | 68,864 KB | 
| 最終ジャッジ日時 | 2024-10-07 00:44:57 | 
| 合計ジャッジ時間 | 2,163 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
n = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
num = 0
lim = 1
cnt = 0
for i in range(n):
    ans += A[i] * num
    cnt += 1
    if cnt == lim:
        cnt = 0
        lim *= 2
        num += 1
    # print(i, cnt, lim, num, ans)
print(ans)
            
            
            
        