結果

問題 No.1416 ショッピングモール
ユーザー U SU S
提出日時 2021-03-05 21:34:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 1,000 ms
コード長 664 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 82,608 KB
実行使用メモリ 72,448 KB
最終ジャッジ日時 2024-04-16 08:53:27
合計ジャッジ時間 2,745 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
60,288 KB
testcase_01 AC 59 ms
60,416 KB
testcase_02 AC 58 ms
60,160 KB
testcase_03 AC 59 ms
60,160 KB
testcase_04 AC 59 ms
60,160 KB
testcase_05 AC 56 ms
60,544 KB
testcase_06 AC 53 ms
60,288 KB
testcase_07 AC 53 ms
60,672 KB
testcase_08 AC 54 ms
60,800 KB
testcase_09 AC 51 ms
60,288 KB
testcase_10 AC 53 ms
60,416 KB
testcase_11 AC 57 ms
63,488 KB
testcase_12 AC 54 ms
60,544 KB
testcase_13 AC 55 ms
63,488 KB
testcase_14 AC 57 ms
63,668 KB
testcase_15 AC 59 ms
64,256 KB
testcase_16 AC 56 ms
63,744 KB
testcase_17 AC 57 ms
64,512 KB
testcase_18 AC 57 ms
64,128 KB
testcase_19 AC 60 ms
64,128 KB
testcase_20 AC 58 ms
64,512 KB
testcase_21 AC 68 ms
72,064 KB
testcase_22 AC 69 ms
72,448 KB
testcase_23 AC 67 ms
72,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys
# input = sys.stdin.readline
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
import math
import bisect
from copy import deepcopy as dc
from itertools import accumulate
from collections import Counter, defaultdict, deque
def ceil(U,V):return (U+V-1)//V
def modf1(N,MOD):return (N-1)%MOD+1
inf = int(1e30)
mod = int(1e9+7)

n = int(input())
a = lmp()
a.sort(reverse=True)
u = []
for i in range(1,17):
    u.append(2**i-1)
ans = 0
cnt = 0
for i in range(17):
    for j in range(cnt, u[i]):
        if cnt >= n:break
        else:
            ans += i*a[cnt]
            cnt += 1
    if cnt >= n:break
print(ans)

0