結果

問題 No.1416 ショッピングモール
ユーザー raven7959raven7959
提出日時 2021-08-25 10:19:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 1,000 ms
コード長 226 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 70,136 KB
最終ジャッジ日時 2024-04-27 22:11:47
合計ジャッジ時間 1,660 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,612 KB
testcase_01 AC 33 ms
51,944 KB
testcase_02 AC 30 ms
51,908 KB
testcase_03 AC 30 ms
52,824 KB
testcase_04 AC 31 ms
53,184 KB
testcase_05 AC 31 ms
53,004 KB
testcase_06 AC 30 ms
53,788 KB
testcase_07 AC 32 ms
52,184 KB
testcase_08 AC 32 ms
52,488 KB
testcase_09 AC 31 ms
52,384 KB
testcase_10 AC 30 ms
52,756 KB
testcase_11 AC 39 ms
60,160 KB
testcase_12 AC 31 ms
52,184 KB
testcase_13 AC 38 ms
60,848 KB
testcase_14 AC 39 ms
59,776 KB
testcase_15 AC 37 ms
61,768 KB
testcase_16 AC 35 ms
59,620 KB
testcase_17 AC 36 ms
61,152 KB
testcase_18 AC 40 ms
61,444 KB
testcase_19 AC 36 ms
61,928 KB
testcase_20 AC 37 ms
60,968 KB
testcase_21 AC 46 ms
69,432 KB
testcase_22 AC 48 ms
70,136 KB
testcase_23 AC 43 ms
69,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=sorted(list(map(int,input().split())),reverse=True)
now=0
ans=0
while 2**(now+1)-1<=N:
  for i in range(2**now-1,2**(now+1)-1):
    ans+=A[i]*now
  now+=1
for i in range(2**now-1,N):
  ans+=A[i]*now
print(ans)
0