結果

問題 No.1416 ショッピングモール
ユーザー roarisroaris
提出日時 2021-03-05 21:25:46
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 106 ms / 1,000 ms
コード長 269 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 82,324 KB
最終ジャッジ日時 2023-07-29 00:56:22
合計ジャッジ時間 3,935 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,628 KB
testcase_01 AC 93 ms
71,660 KB
testcase_02 AC 90 ms
71,516 KB
testcase_03 AC 89 ms
71,436 KB
testcase_04 AC 89 ms
71,712 KB
testcase_05 AC 90 ms
71,680 KB
testcase_06 AC 89 ms
71,480 KB
testcase_07 AC 90 ms
71,676 KB
testcase_08 AC 91 ms
71,716 KB
testcase_09 AC 91 ms
71,736 KB
testcase_10 AC 90 ms
71,708 KB
testcase_11 AC 97 ms
77,268 KB
testcase_12 AC 89 ms
71,500 KB
testcase_13 AC 97 ms
77,412 KB
testcase_14 AC 96 ms
77,624 KB
testcase_15 AC 97 ms
77,408 KB
testcase_16 AC 97 ms
77,204 KB
testcase_17 AC 97 ms
77,180 KB
testcase_18 AC 95 ms
77,236 KB
testcase_19 AC 95 ms
77,428 KB
testcase_20 AC 96 ms
77,584 KB
testcase_21 AC 106 ms
81,752 KB
testcase_22 AC 106 ms
82,308 KB
testcase_23 AC 100 ms
82,324 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