結果

問題 No.1416 ショッピングモール
ユーザー wolgnikwolgnik
提出日時 2021-03-05 21:27:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 1,000 ms
コード長 293 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 83,328 KB
最終ジャッジ日時 2024-04-16 08:47:52
合計ジャッジ時間 2,895 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
52,224 KB
testcase_01 AC 43 ms
52,352 KB
testcase_02 AC 43 ms
52,224 KB
testcase_03 AC 47 ms
52,224 KB
testcase_04 AC 43 ms
52,352 KB
testcase_05 AC 58 ms
61,056 KB
testcase_06 AC 46 ms
52,096 KB
testcase_07 AC 54 ms
60,032 KB
testcase_08 AC 66 ms
64,384 KB
testcase_09 AC 43 ms
52,224 KB
testcase_10 AC 43 ms
52,864 KB
testcase_11 AC 95 ms
76,288 KB
testcase_12 AC 54 ms
59,904 KB
testcase_13 AC 93 ms
75,904 KB
testcase_14 AC 96 ms
76,544 KB
testcase_15 AC 99 ms
76,544 KB
testcase_16 AC 96 ms
76,672 KB
testcase_17 AC 100 ms
77,056 KB
testcase_18 AC 97 ms
76,160 KB
testcase_19 AC 97 ms
76,544 KB
testcase_20 AC 99 ms
76,416 KB
testcase_21 AC 146 ms
80,512 KB
testcase_22 AC 148 ms
81,152 KB
testcase_23 AC 122 ms
83,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))

import heapq
hpush = heapq.heappush
hpop = heapq.heappop

h = []
for x in a: hpush(h, -x)
res = 0
for k in range(N):
  c = 1 << k
  while c > 0 and len(h):
    res += -hpop(h) * k
    c -= 1
print(res)
0