結果

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

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)

k = 0
start = 0
end = 1
ans = 0
C = 0
while True:
    if end >= N:
        ans += sum(A[start:])*C
        break
    else:
        ans += sum(A[start:end])*C
    #print(ans)
    C += 1
    start = end
    end = (end+1)*2 - 1
print(ans)
0