結果

問題 No.1416 ショッピングモール
ユーザー hiragn
提出日時 2022-11-26 19:01:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 56 ms / 1,000 ms
コード長 354 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 15,784 KB
最終ジャッジ日時 2024-10-03 02:57:15
合計ジャッジ時間 2,109 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n = int(input())
    arr = sorted(list(map(int, input().split())), reverse=True)

    kmax = 0
    while 2 ** kmax - 1 < n:
        kmax += 1

    pow2 = []
    for k in range(kmax + 1):
        pow2 += [k] * (1 << k)

    ans = 0
    for a, p in zip(arr, pow2):
        ans += a * p
    print(ans)


if __name__ == "__main__":
    main()
0