結果

問題 No.1416 ショッピングモール
ユーザー roarisroaris
提出日時 2021-03-05 21:25:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 1,000 ms
コード長 269 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 70,144 KB
最終ジャッジ日時 2024-04-16 08:45:04
合計ジャッジ時間 2,417 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
53,376 KB
testcase_01 AC 49 ms
53,504 KB
testcase_02 AC 47 ms
53,504 KB
testcase_03 AC 48 ms
53,376 KB
testcase_04 AC 46 ms
53,248 KB
testcase_05 AC 51 ms
53,632 KB
testcase_06 AC 46 ms
53,376 KB
testcase_07 AC 48 ms
53,632 KB
testcase_08 AC 49 ms
54,016 KB
testcase_09 AC 48 ms
53,376 KB
testcase_10 AC 47 ms
53,632 KB
testcase_11 AC 53 ms
60,928 KB
testcase_12 AC 47 ms
53,760 KB
testcase_13 AC 54 ms
60,672 KB
testcase_14 AC 53 ms
60,672 KB
testcase_15 AC 55 ms
61,568 KB
testcase_16 AC 58 ms
61,056 KB
testcase_17 AC 57 ms
61,568 KB
testcase_18 AC 56 ms
61,824 KB
testcase_19 AC 57 ms
61,952 KB
testcase_20 AC 55 ms
61,440 KB
testcase_21 AC 68 ms
69,248 KB
testcase_22 AC 68 ms
69,632 KB
testcase_23 AC 62 ms
70,144 KB
権限があれば一括ダウンロードができます

ソースコード

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